I've searched everywhere for a solution to this problem, but it is nowhere to be found. Here is the function I am using:
var file = fs.createWriteStream(dest);
http.request(url, function(res) {
res.pipe(file);
});
It's supposed to write the contents of the file specified within the url to a new file on my computer using fs.createWriteStream()
.
It creates the file on my computer, but the problem is is that the file is empty. It doesn't actually "write" the contents of the file specified with the url to the new file.
Any help with this issue would be greatly appreciated! I've been trying to fix this for hours.