CSVParse for Node.js


Option info

The info option provide additionnal context. Instead of generating records, in the form of objects literal or arrays, it generates two properties, info and record. The info property is a snapshot of the info object at the time the record was created. The record property is the actual record.

Note, it can be used conjointly with the raw option.


When the info option is activated with the value true, field is made of the two properties info and record:

import assert from 'node:assert';
import { parse } from 'csv-parse/sync';

const data = "a,b,c";
const records = parse(data, {
  info: true
assert.deepStrictEqual(records, [{
  info: {
    bytes: 5,
    columns: false,
    comment_lines: 0,
    empty_lines: 0,
    error: undefined,
    header: false,
    index: 3,
    invalid_field_length: 0,
    lines: 1,
    raw: undefined,
    records: 1,
  record: [ 'a', 'b', 'c' ]

If info was false, the assertion would have been:

assert.deepStrictEqual(records, [
  [ 'a', 'b', 'c' ]


The Node.js CSV project is an open source product hosted on GitHub and developed by Adaltas.