Files stream
The Io.js and Node.js module for concatenation files on fly. Basically for the textual files's formats only.
What's here? | INSTALL | USAGE | API | TESTS |
---|
Installation
Module can be installed either via git
or via npm
.
Before, you have to installed io.js or node.js and git.
After all, you can clone this repo (for latest version) or just run command below:
$ npm install files-stream
Example Usage
$ node example.js // in module directory
// example.js var WS = WriteStream;var FSS = ;delimiter : '\r\nI\'m between each file!\r\n' encoding : 'ASCII' './test/file.4.txt' './test/file.2.txt' './test/file.3.txt' './test/file.1.txt' // file does not exists
Epress integration:
// Warninig: Don't use this module in production!// Because module haven't yet data bufferization it still remains some troubles in files reading// process, so because you have to use this module for development only.// See below for more info about express integration.var express = var streamOf = expressvar myApp = myApp myApp
API
All module's interfaces (including options parameter and events) are inherited of the Readable stream and Events emitter classes:
var FSS = ;'./file/path''./file/path'|options // or...options
Static FSS.express()
method resembles the same behavior of the files-stream
Class constructor but standing simple callback function.
Where options
are optional and can be placed in arbitrary place of arguments order.
Possible options | Default | Description |
---|---|---|
options.delimiter |
r\n\ | String-delimiter. Placed only between two files. If error occurs on some file, will be placed in order before this erroneous file |
options.encoding |
utf8 | Resembles .setEncoding() method which set up encoding to read each file |
Testing
$ mocha
License
MIT.
To do
- Bufferization
-
Express integration -
More examples~~