npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ferrow/csv-parser

v2.0.0

Published

RFC 4180 CSV parser and stringifier with a chunked streaming API, quoted-field/escaped-quote/embedded-newline handling, and opt-in type coercion. Zero runtime dependencies.

Downloads

102

Readme

csv-parser

CI

An RFC 4180 CSV parser and stringifier for TypeScript/Node. Handles the parts of CSV that trip up naive split(',') implementations: quoted fields, escaped "" quotes, commas and newlines embedded inside quoted fields, both CRLF and LF line endings, and a streaming-friendly chunked API for large inputs. Zero runtime dependencies.

Install

Copy src/index.ts into your project, or build this repo (npm run build) and depend on the compiled dist/.

Quickstart

import { parse, stringify } from 'csv-parser';

const rows = parse('name,age\nAda,36\nBob,29', { coerce: 'auto' });
// [{ name: 'Ada', age: 36 }, { name: 'Bob', age: 29 }]

const csv = stringify(rows);
// "name,age\nAda,36\nBob,29"

Streaming

import { CsvStreamParser } from 'csv-parser';

const parser = new CsvStreamParser({ coerce: 'auto' });
for await (const chunk of readableStream) {
  parser.parseChunk(chunk); // returns rows completed by this chunk
}
parser.flush(); // finalize any trailing unterminated row
const allRows = parser.getResults();

parseChunk correctly handles a quoted field, delimiter, or newline split across chunk boundaries — you don't need to pre-buffer complete lines.

API

  • parse(input, options?) — one-shot parse of a full CSV string.
    • options.delimiter — single-character field delimiter (default ,).
    • options.header — treat row 1 as a header; returns Record<string, value>[] when true (default), or string[][]/value[][] when false.
    • options.coerce — opt-in type coercion, off by default:
      • 'auto' — infer number / boolean (true/false) / null per field.
      • { columnName: 'number' | 'boolean' | 'null' | 'string' } — per-column coercion when header: true.
  • stringify(rows, options?) — serialize Record<string, unknown>[] or unknown[][] back to CSV text, quoting any field that contains the delimiter, a ", or a newline. options.delimiter, options.header, options.newline ('\n' default or '\r\n').
  • class CsvStreamParser<T> — incremental parser: parseChunk(text), flush(), getResults(). Constructor takes the same options as parse minus input.

Scope and limits

  • This is a general-purpose CSV parser, not a schema-validation or data-pipeline library — type coercion is a flat auto/manual mapping, not a validation schema.
  • delimiter must be exactly one character (matches RFC 4180 and most real-world CSV; it does not support multi-character delimiters).
  • Fully blank lines are skipped rather than emitted as empty rows.
  • No BOM stripping is performed — strip a leading UTF-8 BOM yourself if your source may include one.

Sponsored by Ferrow


Part of the ferrow-toolkit collection · Sponsored by Ferrow