Skip to content

Node fs methods as Promise/A+ (optional fs-extra, graceful-fs)

License

Notifications You must be signed in to change notification settings

jonathantneal/fs-promise

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fs-promise

Build Status

Proxies all async fs methods exposing them as ES 2015 (ES6) compatible promises.

Passes all sync methods through as values.

Also exposes to graceful-fs and/or fs-extra methods if they are installed.

Uses any-promise to load preferred Promise implementation.

var fsp = require('fs-promise');

fsp.writeFile(file('hello1'), 'hello world')
  .then(function(){
    return fsp.readFile(file('hello1'), {encoding:'utf8'});
  })
  .then(function(contents){});

Usage

Attempts to load libraries in the following order. The first successful require will be proxied to a Promise based implementation.

Detects a Promise implementation using any-promise. If you have a preferred implementation, or are working in an environment without a global implementation, you must explicitly register a Promise implementation and it will be used. See any-promise for details.

Typical installation:

$ npm install --save fs-extra
$ npm install --save fs-promise

Note that fs-extra depends on graceful-fs, so you would get the benefits of both libraries.

About

Node fs methods as Promise/A+ (optional fs-extra, graceful-fs)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%