Skip to content

Why csv-pipe

  • Typed columns. Column names are checked against your data. A typo or a renamed field is a compile error, not a broken export found in production.
  • Encodes and parses. stringify and parse are mirror images, both typed and streaming, so encode then parse round-trips your rows, with dynamic typing to recover numbers and booleans.
  • Runs where your code runs. The core imports no fs and no DOM, and streaming returns a Web ReadableStream. One import for Node, the browser, Deno, Bun, and edge.
  • Flat memory. Parsing streams one record at a time, and encoding does too once the columns are declared, so a file or HTTP body of any size stays at flat memory.
  • Safe by a flag. sanitizeFormulas neutralizes spreadsheet formula injection (cells starting with =, +, -, @, a tab, or a carriage return), so you never hand-sanitize cells.
  • Fast and small. The fastest common parser by a wide margin, and the fastest or on-par encoder, across every benchmark, at about 2 kB per direction with zero dependencies.

A typo never ships

Columns are checked against your record type. A renamed field cannot silently break an export.

ts
stringify
(
users
, {
columns
: ['name', 'emial'] });
Type '"emial"' is not assignable to type '"name" | "email" | "age"'. Did you mean '"email"'?

Released under the MIT License.