I tried with versions, 10/14/16 and I'm using a mac.
My code base is quite complex, so I tried out something simple as below, yet nothing changed.
Is there something, I'm missing out?
`
const fs = require('fs');
const readableStream = fs.createReadStream('file.txt', 'utf8');
const writableStream = fs.createWriteStream('file-2.txt');
readableStream.on('open', function () {
console.log('opening file')
readableStream.on('data', (chunk) => {
console.log(chunk)
writableStream.write('hey there','utf8', () => {
console.log('Im done writing!')
});
});
writableStream.end();
})
` By the way, as expected I get no errors and the process exit quietly.
I tried the simple snippet above, expecting the file-2.txt to be created and the text "hey there" to be write on it.
Indeed the file is created but, it's empty.
Like I said before, I tried changing node versions(10/14/16) but same results.
I don't know what seems to cause this unexpected result. Any help will be appreciated.