A question about reading and writing Node files, why can’t fs.createWriteStream be used?

  node.js, question

A few days ago to write a program inside, with a code similar to this:

fs.createReadStream('./template/pc.ftl')
 .pipe(
 //  ....
 )
 .pipe(fs.createWriteStream('./template/abc.ftl'));

At that time, it was tested many times and was operational.
Today, I suddenly can’t write, specifically, abc.ftl content is empty
The pipe in the middle of the test read the contents of the file, but once the file is written, it will be empty.
Even if I write this program like this:

fs.createReadStream('./template/pc.ftl')
 .pipe(fs.createWriteStream('./template/abc.ftl'));

No, so it should befs.createWriteStreamThe problem is,
May I ask why?

You can try:

fs.createReadStream('./template/pc.ftl')
 .pipe(fs.createWriteStream('./template/abc.ftl'))
 .on('error', function(e){
 console.error(e)
 })