I am trying to write a file to a network drive with nodejs.
I have a network drive mounted. I can read it and write to the network drive from shell.
I am using this to copy a file:
fs_extra.copy('tempFileLocation', 'networkDrive' + 'uniqueName', function(err) {
if (err) {
console.error(config.new_location + " -- " + err);
} else {
console.log("success! ");
}
});
This does create the correct file name on the network drive.
The issue here is that the file is always only 0 bytes.
Update:
This writes the file to the connected network drive.
var file5 = fs.createWriteStream('networkDrive' + 'uniqueName');
var request5 = https.get(PICTURE_URL, function(response5) {
response5.pipe(file5);
});
I really did not want to write the file with https.get . I wanted to write to the /tmp folder and check for errors. Then copy to network drive from /tmp folder.
Anyone know why the fs_extra.copy is not working?
Any help is appreciated.
Thanks Phil