pfs

The promise-based alternative for the node.js fs module

npm install pfs
2 downloads in the last week
4 downloads in the last month

pfs

The promise-based alternative for the node.js fs module.

This module provides the file operations based on the promise pattern. All operations are the same as the node.js fs module but the results are presented as promises.

For example pfs.readFile equals to fs.readFile but uses not a callback based asyncronious but the promise based one.

Documentation

  1. The fs module operations are described at http://nodejs.org/api/fs.html.
  2. The promise operations are described at https://github.com/kriskowal/q.

Examples

  1. A simple file read operation
var pfs = require("pfs");

var filePromise = pfs.readFile("./StorageEditor/BlockEditor.html");

filePromise.then(function(data) {
    console.log(data.toString());
})
.catch(function(error) {
    console.log(error);
});
npm loves you