rotatable

3.0.0 • Public • Published

rotatable

Subclass of fs.WriteStream that supports automatic file rotations, from multiple parallel processes. Only supports append mode.

Usage

var rotatable = require( "rotatable" );
 
// create a test.log file, and rotate it every 10mb
var stream = rotatable( "test.log", { size: "10mb" } );
stream.on( "rotate", function ( newpath ) {
    // compress and or upload to s3
})
 
// pipe some data into the stream
otherstream.pipe( stream );
 
// or - use it in a Moran log
express()
    .use( morgan( { stream: stream } ) )
 
rotatable( path [, options ] )

Creates and returns a new RotateStream with the same arguments.

options is forwarded as is to the fs.WriteStream constructor. It also supports the following properties:

rotatable.RotateStream

RotateStream is subclass of Node's fs.WriteStream.

Event: 'rotate'

  • rotated the path to the rotated file

Emitted when the stream has finished rotating

Readme

Keywords

Package Sidebar

Install

npm i rotatable

Weekly Downloads

0

Version

3.0.0

License

MIT

Unpacked Size

30.5 kB

Total Files

7

Last publish

Collaborators

  • avinoamr