The promise-based alternative for the node.js fs module
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.
- The fs module operations are described at http://nodejs.org/api/fs.html.
- The promise operations are described at https://github.com/kriskowal/q.
- A simple file read operation
var pfs = require"pfs";var filePromise = pfsreadFile"./StorageEditor/BlockEditor.html";filePromisethenconsole.logdatatoString;catchconsole.logerror;;