rotate-file-stream
This is a really simple stream that pipes data into fs.WriteStream, and rotates the files after some time.
Installation
npm install --save rotate-file-stream
Usage
var rotateFileStream = require('rotate-file-stream');
var rfs = rotateFileStream(__dirname+'/parts', { // returns a regular stream.Writable
interval: 10000, // rotation interval
appendFileName: function (i) {
return '_part'+i+'.txt'; // how to name the new files
}
});
someOtherStream.pipe(rfs);
The default interval is 36e5
(1 hour), and the default appendFileName function is function (part) { return '_part'+part; }
License
MIT