Socket
Socket
Sign inDemoInstall

async-csv

Package Overview
Dependencies
6
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    async-csv

ES7 async-await wrapper for the csv package.


Version published
Weekly downloads
80K
increased by11.14%
Maintainers
1
Install size
2.92 MB
Created
Weekly downloads
 

Readme

Source

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

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.

Keywords

FAQs

Last updated on 30 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc