CSV for Node.js


File system interaction

The native Node.js File System module named fs is used to read and write the content of a file.

This file system recipe illustrates how to use the pipe function.

import fs from "node:fs";
import assert from "node:assert";
import { finished } from "node:stream/promises";
import { parse, transform, stringify } from "csv";

const __dirname = new URL(".", import.meta.url).pathname;
await fs.promises.writeFile(

await finished(
    .pipe(transform((record) => record.reverse()))

  await fs.promises.readFile(`${__dirname}/example.fs.output.csv`, "utf8"),


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