file-timestamp-stream
This module creates stream.Writable to a file which is automatically rotated based on current time.
Installation
npm install file-timestamp-stream
Usage
const FileTimestampStream = require('file-timestamp-stream')
const stream = new FileTimestampStream({
path: '%Y-%m-%dT%H.log',
flags: 'a'
})
Options:
newFilename
is a custom function which returns new filename (default: returns new filename based on path and current time)flags
is a string with flags for opened stream (default: 'a'
)fs
is a custom fs module (optional)path
is a template for new filenames (default: 'out.log'
)
Properties:
currentFilename
contains last opened filenamewstream
contains fs.WriteStream object
Path template format:
Path can contain strftime specifiers.
License
Copyright (c) 2017 Piotr Roszatycki piotr.roszatycki@gmail.com
MIT