Saturday 23 December 2017

How to create a readable stream from a writeable stream?

I want to convert a csv file to json. For that I need a readable stream:const csvReadStream = fs.createReadStream(file.path); Now the problem occured, that I need it in UTF8. The conversion works well with: const csvReadStream = fs.createReadStream(file.path) .pipe(iconv.decodeStream('iso-8859-1')) .pipe(iconv.encodeStream('utf8')) .pipe(fs.createWriteStream(file.path + '_new')); My problem now is: how do I create a readable stream from the new file / writable stream?const csvReadStream = fs.createReadStream(file.path + '_new'); doesnt work unfortunately. I would appreciate some help!

Submitted December 23, 2017 at 04:28PM by Shovez

No comments:

Post a Comment