rotate-file-stream

0.0.4 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i rotate-file-stream

Weekly Downloads

5

Version

0.0.4

License

MIT

Last publish

Collaborators

  • joaojeronimo