Created
December 19, 2018 21:42
-
-
Save cpietsch/bfc4f4881286833e2371cebdaf5b07c4 to your computer and use it in GitHub Desktop.
nodejs script to download images from a csv file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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