3.0.0 • Published 6 years ago

rotatable v3.0.0

Weekly downloads
85
License
MIT
Repository
github
Last release
6 years ago

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

3.0.0

6 years ago

2.2.4

8 years ago

2.2.3

8 years ago

2.2.2

8 years ago

2.2.1

8 years ago

2.1.13

9 years ago

2.1.12

9 years ago

1.1.5

9 years ago

1.1.4

9 years ago