showing results for - "node js request download file"
Juniper
14 Nov 2020
1const http = require('http'); // or 'https' for https:// URLs
2const fs = require('fs');
3
4const file = fs.createWriteStream("file.jpg");
5const request = http.get("http://i3.ytimg.com/vi/J---aiyznGQ/mqdefault.jpg", function(response) {
6  response.pipe(file);
7});
8