# async-csv

> ES7 async-await wrapper for the csv package.

Latest version **2.1.3** (published 2019-12-30) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install async-csv
pnpm add async-csv
yarn add async-csv
bun add async-csv
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.3 |
| Published | 2019-12-30 |
| First published | 2018-02-08 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | separate (@types/async-csv) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Anton Ivanov |
| Maintainers | anton-ivanov |
| Keywords | csv, async, es7, csv-parser, csv-stringify, await-csv, async-csv-formatter, save-csv-to-file |

## Links

- npm: https://www.npmjs.com/package/async-csv
- Repository: https://github.com/anton-bot/async-csv
- Homepage: https://github.com/catcher-in-the-try/async-csv#readme
- Issues: https://github.com/catcher-in-the-try/async-csv/issues
- npm.io page: https://npm.io/package/async-csv

## Dependencies (1)

- [csv](https://npm.io/package/csv.md) ^5.1.3

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 2.1.3 (latest) — 2019-12-30
- 3.0.0-pre3 (next) — 2019-07-23
- 2.1.2 — 2019-10-16
- 3.0.0-pre2 — 2019-07-23
- 3.0.0-pre — 2019-07-23
- 2.1.1 — 2019-07-12
- 2.1.0 — 2019-07-06
- 2.0.1 — 2019-06-05
- 2.0.0 — 2018-10-09
- 1.0.1 — 2018-06-13
- 1.0.0 — 2018-02-08

## README

# ES7 async wrapper for csv package #

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

## If you just want to read a CSV file ##

```js
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](https://www.npmjs.com/package/csv).

## 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.

```js
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.

---
_Source: https://npm.io/package/async-csv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
