Skip to content

Typed CSV, encode and parse, for every runtime

A small, fast, zero-dependency CSV encoder and parser for TypeScript and JavaScript. RFC 4180 correct, checked against your data, and the same core on Node, browsers, Deno, Bun, and edge.

One line for the common case

ts
import { 
stringify
} from 'csv-pipe';
type
User
= {
name
: string;
email
: string;
age
: number };
const
users
:
User
[] = [
{
name
: 'Alex Johnson',
email
: 'alex@example.com',
age
: 29 },
{
name
: 'Carlos Herrera',
email
: 'carlos@example.com',
age
: 24 }
];
stringify
(
users
);
// name,email,age // Alex Johnson,alex@example.com,29 // Carlos Herrera,carlos@example.com,24

The header comes from the record keys, and a field is quoted only when it needs to be.

And back again

ts
import { 
parse
} from 'csv-pipe';
type
User
= {
name
: string;
email
: string;
age
: number };
const
users
=
parse
<
User
>('name,email,age\nAlex Johnson,alex@example.com,29');

parse is the mirror of stringify, typed and streaming, so encode then parse round-trips your rows. Get started, read why csv-pipe, or see the benchmarks.

Released under the MIT License.