0.1.0 • Published 11 years ago
filerw v0.1.0
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
});
0.1.0
11 years ago