filerw

0.1.0 • Public • Published

node-filerw

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

API

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');
filerw.read('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
});

Dependencies (4)

Dev Dependencies (5)

Package Sidebar

Install

npm i filerw

Weekly Downloads

0

Version

0.1.0

License

none

Last publish

Collaborators

  • tkellen