Skip to content

Instantly share code, notes, and snippets.

@viraj124
Created November 19, 2021 10:27
Show Gist options
  • Save viraj124/c9ad6a045aa2e040eb0773457d60649a to your computer and use it in GitHub Desktop.
Save viraj124/c9ad6a045aa2e040eb0773457d60649a to your computer and use it in GitHub Desktop.
array_generation.ts
import fs from 'fs'
import csv from 'csv-parser'
const json: any = []
fs.createReadStream('scripts/input.csv')
.pipe(csv())
.on('data', (row: any) => {
const val: any = Object.values(row)[0]
json.push(val)
})
.on('end', () => {
console.log(json)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment