Skip to content

Instantly share code, notes, and snippets.

@PatheticMustan
Created July 15, 2023 01:00
Show Gist options
  • Save PatheticMustan/4fa23d0a9b4f866569122d8d5cf3e065 to your computer and use it in GitHub Desktop.
Save PatheticMustan/4fa23d0a9b4f866569122d8d5cf3e065 to your computer and use it in GitHub Desktop.
hehehehe
const fs = require('fs'),
request = require('request');
const download = (uri, filename, callback) => {
request.head(uri, (err, res, body) => {
request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);
});
};
// this line was replaced
const imgList = `link\nlink\nlink`
function v(i) {
download(imgList[i], imgList[i].slice(-14), () => {
console.log(`${i+1}/2154 downloaded`);
if (i+1 !== 2154) v(i+1);
});
}
v(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment