CSVStringify for Node.js


Option bom

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


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.


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

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

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


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