Log values from streams as a csv with timestamp
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

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