object-stream-to-fs
Version:
Stream objects to a file and store it to be read from JSONStream
54 lines (31 loc) • 1.02 kB
Markdown
Consume a stream of objects and save them to a file.
Specify a path to the target file.
[](https://travis-ci.org/nickpoorman/object-stream-to-fs)
save objects to a file:
``` js
var s = objectStreamToFS('/tmp/test-file');
var d = dump('mongodb://127.0.0.1/test_db', 'testcollection');
d.pipe(s);
s.on('done', function(){
console.log("the object stream has been consumed!")
});
```
``` js
var objectStreamToFS = require('object-stream-to-fs')
```
Consume the entire stream of objects.
The returned object `s` is a [Stream](http://nodejs.org/api/stream.html).
Emitted when all writes have been completed and the object stream has been consumed.
With [npm](https://npmjs.org) do:
```
npm install object-stream-to-fs
```
MIT