I'm trying to upload and parse file line by line by like the following:
var fs = require('fs'),
es = require('event-stream'),
filePath = './file.txt';
fs.createReadStream(filePath)
.pipe(new Iconv('cp866', 'windows-1251'))
.pipe(es.split("\n"))
.pipe(es.map(function (line, cb) {
//do something with the line
cb(null, line)
}))
.pipe(res);
But unfortunately I get 'line' string in utf-8 encoding. Is it possible to prevent evented-stream change encoding?