Last active
June 16, 2020 13:36
-
-
Save cs09g/b6f9e1af43cf8c4b47cb8b4d10c604b5 to your computer and use it in GitHub Desktop.
[nodejs] parsing remote csv (feat. csv-parser)
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
const http = require("http"); | |
const csv = require("csv-parser"); | |
const csvPath = "http://remoteurl/some.csv"; | |
const results = []; | |
http.get(csvPath, | |
(response) => { | |
response | |
.pipe(csv()) | |
.on("data", (chunk) => results.push(chunk)) | |
.on("end", () => { | |
// "results" is the parsed csv | |
// do what you want | |
}); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment