0.1.0 • Published 11 years ago
recordio-file v0.1.0
recordio-file
A node-task RecordIO interface for local filesystems.
API
read(path, options)
Read a file from the local filesystem and return a promise which resolves to a node-task Record representing it.
The options
object supports these keys:
encoding
The encoding of the file to be read.
var recordio = require('recordio-file');
recordio.read('test/fixtures/foo.txt', { encoding: 'utf8' }).then(function (self) {
console.log(self) // <Record "test/fixtures/foo.txt" <Buffer 66 6f 6f>>
});
write(record, options)
Save a node-task Record to the local filesystem.
The options
object supports these keys:
n/a
var Record = require('record');
var recordio = require('recordio-file');
var record = new Record('tmp/test.txt', 'utf8', 'test file');
recordio.write(record).then(function(self) {
console.log(self); // <Record "tmp/test.txt" <Buffer 74 65 73 74 20 66 69 6c 65>>
});
0.1.0
11 years ago