javascript - require filename while downloading file using request module nodejs -
I use the request module in nodes to download the file (image file only) using this I'm doing, or But I only have url available and I need it to protect the file from its real name, so I must get the file name from the given url, Please suggest to me how the last part of the URL has been removed Thank you in advance ... A simple solution can be:
request ('http://google.com/doodle.png'). Pipe (fs.createWriteStream ('doodle.png')),
request (url) .pipe (fs.createWriteStream (filename)) ,
Comments
Post a Comment