I am not sure what the Windows command "copy /b ..." exactly does, so my questions are: Can this be done with Node.js? How?
Could you please give me an example or at least point me to the right direction?
For e. g.: "copy /b file1+file2 destinationFile"
Thank you.
copy is an internal command in Windows. copy /b file1+file2 destinationFile creates destinationFile with contents of file1 followed by file2 including extra characters like EOF due to /b.
Here is how to do it in node.js :
fs = require('fs');
file1=fs.createReadStream('./file1',{ flags: 'r', encoding: "binary",});
file2=fs.createReadStream('./file2',{ flags: 'r', encoding: "binary",});
dest=fs.createWriteStream('./destinationFile',{ flags: 'w', encoding: "binary",});
file1.pipe(dest, { end: false });
file2.pipe(dest, { end: false });