I've seen alot of NodeJs question about downloading file from given URL. But my issue here is that, the image URL is an auto download type, where when pasted on browser, it won't show the image on the browser but will auto download that said image immediately.
This code works on the direct image URL, and i can see the downloaded file on the folder.
request.head(targetURL, (err, res, body) => {
request(targetURL)
.pipe(fs.createWriteStream(path.join(__dirname, '..', 'assets', 'download.jpg')))
.on('close', () => {
console.log('Done!')
});
});
But when i try to use auto download link, i see 1kb size image that is empty. I cannot get the supposed image from the auto download link.
Did i do anything wrong in here?
Ps: Just to add here, this link is not a direct URL to the image.. its a link that triggers the download of that said image. In this case, i want to know how would NodeJs handles with it.