A drop-in replacement for Node's native fs module which adds fs.Async and
fs.Sync namespaces with identical method names and APIs. So
fs.Async.readFile is the same as fs.readFile, and fs.Sync.readFile is a
wrapped version of fs.readFileSync which passes the result to a callback
instead of just returning it.
Installation
npm install --save fs-mode
Usage
var fs = require('fs-mode');function myModule (fs, otherArg, callback) { // normal fs stuff using async methods fs.readFile('myFile', function (err, data) { if (err) return callback(err); var result = doSomethingTo(data); callback(null, result); });}module.exports = { myModule: myModule.bind(null, fs.Async), myModuleSync: function (otherArg) { var result; myModule(fs.Sync, otherArg, function (err, data) { if (err) throw err; result = data; }); return result; }}