1

I want to copy a file from a folder to another folder present in my PC using node.js. Below is the code. File gets transfered with 0kb. Please suggest how to solve this?

function copyFile(source, target) {
     var readerStream = fs.createReadStream(source);
     var writerStream = fs.createWriteStream(target);
     readerStream.pipe(writerStream);
}

Thanks in advance

Akshatha
  • 39
  • 4

0 Answers0