node-csv

repository·master·Indexed 26 days ago

https://github.com/adaltas/node-csv

A mature suite of tools for CSV generation, parsing, transformation, and serialization designed for Node.js and web environments. The project includes specialized packages: csv-generate for creating CSV strings or JavaScript objects, csv-parse for converting CSV text into arrays or objects, csv-stringify for converting records into CSV text, and stream-transform for processing data streams. It supports Node.js Stream APIs, synchronous and callback APIs, and is compatible with ESM, CommonJS, and browser environments.

Tokens
9.5K
Snippets
19
Records
74
Agent score
85%

What's inside node-csv

  1. Overview of csv packages

    master

    The csv project provides several specialized packages for handling CSV data:

    • csv-generate: A flexible generator of CSV strings and JavaScript objects.
    • csv-parse: A parser that converts CSV text into arrays or objects.
    • csv-stringify: A stringifier that converts records into CSV text.
    • stream-transform: A transformation framework for processing data streams.
  2. Overview of stream-transform features

    master

    The stream-transform project is a simple object transformation framework that supports:

    • Node.js Stream API: Extends the native stream.Transform API for scalability.
    • Multiple API Flavors: Provides callback-based, synchronous, and stream-based APIs.
    • Flexible Input/Output: Accepts objects, arrays, or JSON.
    • Execution Modes: Supports both synchronous and asynchronous user functions, as well as sequential and parallel/concurrent execution.
    • Record Manipulation: Ability to skip records, multiply records, alter records, or clone input records.
  3. Overview of csv-parse features

    master

    The csv-parse package is a flexible CSV parser for Node.js and the web with the following capabilities:

    • Multiple Distributions: Supports Node.js, Web, ECMAScript modules (ESM), and CommonJS (CJS).
    • API Flavors: Provides a Node.js streaming API for scalability, as well as simple callback and synchronous APIs for convenience.
    • Parsing Support: Handles delimiters, quotes, escape characters, comments, and automatic line break discovery.
    • No Dependencies: The package has no external dependencies.
    • Ecosystem Integration: Works seamlessly with csv-generate, stream-transform, and csv-stringify.
  4. Overview of csv-stringify APIs

    master

    The csv-stringify package provides three main ways to convert records into CSV text:

    1. Node.js Stream API: Implements stream.Transform for high scalability and handling big datasets.
    2. Callback API: A simpler asynchronous approach for convenience.
    3. Synchronous API: The easiest way to convert data to a string synchronously (available via csv-stringify/sync).

    Key features include support for custom formatters, delimiters, quotes, escape characters, and headers.

  5. Overview of node-csv packages

    master
    The node-csv project provides a suite of tools for CSV generation, parsing, transformation, and serialization compatible with both Node.js and the web. It is available as several specialized NPM packages depending on your needs.
  6. Run the CommonJS CSV demo tests

    master

    To verify the samples in the CommonJS demo, you can execute the test suite which runs each sample located in the ./lib folder. Use the command corresponding to your Node.js version:

    • For Node.js 12 and above: yarn test
    • For Node.js 8 to 11: ./test/node8.sh
    yarn test
  7. Use the ESM demo for Node.js

    master
    The csv-demo-esm package provides examples of how to use the csv library within a Node.js environment using ECMAScript Modules (ESM). It includes implementations in both JavaScript and TypeScript to demonstrate compatibility and usage patterns for modern Node.js projects.