Skip to content

yuda-lyu/w-data-csv

Repository files navigation

w-data-csv

A tool for csv data.

language npm version license gzip file size npm download npm download jsdelivr download

Documentation

To view documentation or get support, visit docs.

Installation

Using npm(ES6 module):

Note: w-data-csv is mainly dependent on csv-parser and strip-bom-stream.

npm i w-data-csv

Example for read:

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)
    })

Example for write:

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)
    })

About

A tool for csv data.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published