log-csv-stream

Log values from streams as a csv stream with timestamp

npm install log-csv-stream
1 downloads in the last week
4 downloads in the last month

Build Status Dependency Status

log-csv-stream

Designed to work with https://github.com/robertkowalski/temperature-stream, but you can log all values as CSV

  var csv = csvLog()
  var target = fs.createWriteStream(__dirname + '/temp.txt')
  fs.createReadStream(__dirname + '/input.txt')
    .pipe(csv)
    .pipe(target) // 1373750981527;22570\n

You can define delimiter and line-end:

  var csv = csvLog(',', '|')
  var target = fs.createWriteStream(__dirname + '/temp.txt')
  fs.createReadStream(__dirname + '/input.txt')
    .pipe(csv)
    .pipe(target) // 1373750981527,22570|

You can even use custom timestamps! This is so amazing!

  var csv = csvLog(';', '\n', new Date().toString())
  var target = fs.createWriteStream(__dirname + '/temp.txt')
  fs.createReadStream(__dirname + '/input.txt')
    .pipe(csv)
    .pipe(target) // So Jul 14 2013 12:32:33 GMT+0200 (CEST);22570\n
npm loves you