Last active
July 9, 2020 03:17
-
-
Save d4v3y0rk/7de6814d34c6185d224eaed48ce7fe57 to your computer and use it in GitHub Desktop.
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 csv = require('csvtojson') | |
const fs = require('fs') | |
// this no worky | |
function dosomething(data) { | |
console.log(data) | |
} | |
async function main() { | |
var mappingData = await parseCSV("map.csv", ",") | |
const fileStream = fs.createReadStream("src.csv") | |
const writeFile = fs.createWriteStream('output.csv') | |
// read the csv => do some work => write the final thing back out to another csv file | |
fileStream.pipe(csv()).pipe(dosomethings()).pipe(writeFile) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment