CSVStringify for Node.js

IssuesGitHub

Option bom

The bom option prepend the byte order mark (BOM) to the output stream.

About

The UTF-8 BOM is a sequence of Bytes at the start of a text-stream (EF BB BF or \ufeff) that allows the reader to reliably determine if file is being encoded in UTF-8.

Example

Default is the boolean value false. The bom example simply activates the option:

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

const data = stringify([
  [ 'a', 'b', 'c' ]
], {
  bom: true
});
assert.deepStrictEqual(data, "\ufeffa,b,c\n");

About

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