Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fse-promise

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fse-promise

Promisefied version of fs-extra and fs that preserves callbacks

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source

fse-promise

Promisified version of Node fs and fs-extra that preserves callbacks.

NPM version

Install

npm install fse-promise

Usage

Drop-in replacement for Node fs and fs-extra module.

All Node fs and fs-extra asynchronous methods are wrapped so that they return a promise if callback is not provided. If callback is defined then the method works as defined in fs and fs-extra.

Check index.js for list of supported methods. If you notice any missing methods in that list, add it and create PR to get it added.

Example usage:

const fs = require('fse-promise');

// using callbacks
fs.readFile(filepath, (err, data) => {
	if (err) return console.error(err);
	console.log(data);

	fs.outputFile(filepath, (err, data => {
		if (err) return console.error(err);
		console.log('saved');
	}));
});

// using promises
fs.readFile(filepath)
	.then((data) => {
		console.log(data);

		return fs.outputFile(filepath);
	})
	.then(() => {
		console.log('saved');
	})
	.catch((err) => {
		console.error(err);
	});

Keywords

FAQs

Package last updated on 20 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc