ac
async-csv
npm i async-csv
ac

async-csv

ES7 async-await wrapper for the popular `csv` package.

by Anton Ivanov

2.1.3 (see all)License:UnlicenseTypeScript:DefinitelyTyped
npm i async-csv
Readme

async wrapper for csv package

This is a TypeScript / JavaScript wrapper for the popular csv package that can be used with the ES7 async-await pattern, instead of using callbacks.

Also, it features type definitions which is useful for TypeScript.

If you just want to read a CSV file

const csv = require('async-csv');
const fs = require('fs').promises;

(async() => {
  // Read file from disk:
  const csvString = await fs.readFile('./test.csv', 'utf-8');

  // Convert CSV string into rows:
  const rows = await csv.parse(csvString);
})();

Documentation

For all documentation, please see the documentation for the csv package.

Usage examples

All parameters are the same as for the functions in the csv module, except that you need to omit the callback parameter.

If there is any error returned by the csv package, an exception will be thrown.

const csv = require('async-csv');

 // `options` are optional
let result1 = await csv.generate(options);
let result2 = await csv.parse(input, options);
let result3 = await csv.transform(data, handler, options);
let result4 = await csv.stringify(data, options);

Feedback

Feedback, bug reports and pull requests are welcome. See the linked Github repository.

Downloads/wk

56.3K

GitHub Stars

11

LAST COMMIT

1yr ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

3

OPEN PRs

3
VersionTagPublished
2.1.3
latest
2yrs ago
3.0.0-pre3
next
3yrs ago
No alternatives found
No tutorials found
Add a tutorial