Skip to content

Instantly share code, notes, and snippets.

@d4v3y0rk
Last active July 9, 2020 03:17
Show Gist options
  • Save d4v3y0rk/7de6814d34c6185d224eaed48ce7fe57 to your computer and use it in GitHub Desktop.
Save d4v3y0rk/7de6814d34c6185d224eaed48ce7fe57 to your computer and use it in GitHub Desktop.
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