cut-file-stream

1.2.0 • Public • Published

Cut Log File Stream

Support morgan
Support timeZone

Install

npm install --save cut-file-stream

Usage

Format filename:

  • YYYY => Year
  • MM => Month
  • DD => Day
  • H => Hour
  • M => minute
  • S => Second

Cut file stream by day

var cts = require('cut-file-stream');
var stream = cfs.getStream({
    filename: 'custom-string-YYYYMMDD-custom-string.log',
    timeZone: 0 // UTC
});

Cut file stream by hour

var cts = require('cut-file-stream');
var stream = cfs.getStream({
    filename: 'custom-string-YYYYMMDDH-custom-string.log',
});

Cut file stream by minute

var cts = require('cut-file-stream');
var stream = cfs.getStream({
    filename: 'custom-string-YYYYMMDDHM-custom-string.log'
});

Get format datetime

var cts = require('cut-file-stream');
var stream = cts.getDateTime('YYYYMMDDHM');
// return 201507311230

If no filename, stdout will return

If no timeZone, default timeZone will be BeiJing: UTC+8

Bug fixed list

2015/07/31 Export method getDateTime 2015/07/16 Support multi log file steam

Contact

If you have any question, please contact me zhaoshuxiang2010@gmail.com

Package Sidebar

Install

npm i cut-file-stream

Weekly Downloads

1

Version

1.2.0

License

MIT

Last publish

Collaborators

  • shuxiang