CSVStringify for Node.js

IssuesGitHub

Option header_as_comment

The header_as_comment option prints the list of columns in the header as a comment.

Usage

This option implies discovery of columns and the activation of the header columns.

import { stringify } from "csv-stringify";
import assert from "node:assert";

stringify(
  [{ a: "1", b: "2" }],
  {
    header: true,
    header_as_comment: "//",
  },
  function (err, data) {
    assert.equal(data, "// a,b\n1,2\n");
  },
);

About

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