CSVStringify for Node.js

IssuesGitHub

Option delimiter

The delimiter option set the delimiter between the fields of a record. It can be one or multiple characters. The default value is a comma ,.

Default behavior

By default the generated CSV data set has fields separated by commas ,:

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

stringify([
  ['1', '2'],
  ['3', '4']
], function(err, records){
  assert.equal(records, '1,2\n3,4\n');
});

Custom behaviour

One or multiple characters can be defined to customise the field delimiter:

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

stringify([
  ['1', '2'],
  ['3', '4']
], {
  delimiter: ':)'
}, function(err, records){
  assert.equal(records, '1:)2\n3:)4\n');
});

About

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