node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



A node-task compliant read-write interface for local filesystems.


read(path, options)

Read a file from the local disk and return a promise which resolves to a node-task compliant record.

The options object supports these keys:

  • encoding The encoding of the file to be read.
var filerw = require('filerw');'test/fixtures/foo.txt', { encoding: 'utf8' }).then(function (self) {
  console.log(self.toString()) // 'foo' 

write(buffer, options)

Save a node-task compliant buffer to the local disk.

The options object supports these keys: n/a

var filerw = require('./lib/filerw');
var file = new Record('tmp/test.txt', 'utf8', 'test file');
filerw.write(file).then(function(self) {
  console.log(self); // file