CSVStringify for Node.js

IssuesGitHub

Option quote

The quote option defines the characters surrounding a field, defaults to the " (double quotation marks).

It is possible to disable quoting by setting the option value to false or an empty string. The setting applies at any time, whether it contains a special character or not.

Example

The custom quote example defines a custom value. The output field is surrounded with the pipe character because it contains a comma which is the default field separator.

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

const records = stringify([
  ['a,b']
], {
  quote: '|'
});

assert.equal(records, '|a,b|\n');

About

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