A tool for csv data.
To view documentation or get support, visit docs.
Note: w-data-csv is mainly dependent on
csv-parser
andstrip-bom-stream
.
npm i w-data-csv
Link: [dev source code]
import wdc from './src/WDataCsv.mjs'
let fp = './g-test-in.csv'
wdc.readCsv(fp)
.then((ltdt) => {
console.log(ltdt)
// => [ { NAME: 'Daffy Duck', AGE: '24' }, { NAME: 'Bugs 邦妮', AGE: '22' } ]
})
.catch((err) => {
console.log(err)
})
Link: [dev source code]
import wdc from './src/WDataCsv.mjs'
let ltdt = [{ name: '大福 Duck', value: 2.4 }, { name: 'Bugs 邦妮', value: '2.2' }]
let fp = './g-test-out.csv'
wdc.writeCsv(fp, ltdt)
.then((res) => {
console.log(res)
// => finish
})
.catch((err) => {
console.log(err)
})