Skip to content

Instantly share code, notes, and snippets.

@cpietsch
Created December 19, 2018 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpietsch/bfc4f4881286833e2371cebdaf5b07c4 to your computer and use it in GitHub Desktop.
Save cpietsch/bfc4f4881286833e2371cebdaf5b07c4 to your computer and use it in GitHub Desktop.
nodejs script to download images from a csv file
var fsPromises = require('fs').promises
var dsv = require('d3-dsv');
var download = require('download');
async function all(){
let data = dsv.csvParse(await fsPromises.readFile("data.csv", { encoding: "utf8" }))
for(let entry of data) {
console.log(entry.url, entry.id)
await download(entry.url, "images", {filename: entry.id + ".jpg"})
}
}
all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment