flow-read
Thin wrapper for graceful-fs file read stream.
Installation
$ npm install flow-read
API
To create a readStream factory,
var readStream =rStream = ;
rStream.path( [filepath] )
This method is a setter/getter. If no filepath
is provided, returns the filepath
. You configure the stream factory by specifying a filepath
:
rStream;
rStream.stream( [clbk] )
Provided a filepath
has been specified, to create a new readStream:
var stream = rStream;
Where the optional clbk
is invoked upon stream end
and has an error
as its first argument. If no read errors, error
is null
.
Usage
Methods are chainable:
;
Examples
// File read stream generator:var readStream = ;// Create a new stream, passing along an optional error handler:var stream =;// Pipe the stream:stream;// Error handler:{if errorconsole;throw 'Error!!!' ;console;}
Tests
Unit tests use the Mocha test framework with Chai assertions.
Assuming you have installed Mocha, execute the following command in the top-level application directory to run the tests:
$ mocha
All new feature development should have corresponding unit tests to validate correct functionality.
License
Copyright
Copyright © 2014. Athan Reines.