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

@input-kit/csv

v0.1.0

Published

CSV parser and formatter

Readme

@input-kit/csv

Zero-dependency CSV parser, formatter, and async stream reader for TypeScript/JavaScript.

Installation

npm install @input-kit/csv

Quick Start

import { parseCSV, stringifyCSV } from '@input-kit/csv';

const result = parseCSV(`name,age\nAlice,30\nBob,25`);
// result.data → [{ name: 'Alice', age: '30' }, { name: 'Bob', age: '25' }]

const csv = stringifyCSV([{ name: 'Alice', age: '30' }]);
// "name,age\nAlice,30"

API Reference

parseCSV(csv, options?)

Parses a CSV string into an array of objects (with header) or arrays (without).

function parseCSV<T = Record<string, string>>(
  csv: string,
  options?: ParseOptions
): ParseResult<T>

ParseOptions

| Option | Type | Default | Description | |--------|------|---------|-------------| | delimiter | string | ',' | Field separator | | newline | string | '\n' | Row separator | | quoteChar | string | '"' | Quote character for fields with special chars | | escapeChar | string | '"' | Escape character inside quoted fields | | header | boolean | true | Treat first row as header | | skipEmptyLines | boolean | true | Skip blank lines |

ParseResult<T>

| Property | Type | Description | |----------|------|-------------| | data | T[] | Parsed rows | | errors | Array<{ row: number; message: string }> | Row-level parse errors | | meta.fields | string[] \| undefined | Header fields (when header: true) | | meta.rowCount | number | Number of data rows |


stringifyCSV(data, options?)

Serialises an array of objects to a CSV string. Fields containing the delimiter, newline, or quote character are automatically quoted and escaped.

function stringifyCSV<T = Record<string, string>>(
  data: T[],
  options?: StringifyOptions
): string

StringifyOptions

| Option | Type | Default | Description | |--------|------|---------|-------------| | delimiter | string | ',' | Field separator | | newline | string | '\n' | Row separator | | quoteChar | string | '"' | Quote character | | header | boolean | true | Emit a header row from object keys |


parseCSVStream(stream, options?)

Async generator for memory-efficient parsing of large CSV ReadableStream<string> sources. Yields one Record<string, string> per row.

async function* parseCSVStream(
  stream: ReadableStream<string>,
  options?: ParseOptions
): AsyncGenerator<Record<string, string>>
const stream = response.body!.pipeThrough(new TextDecoderStream());
for await (const row of parseCSVStream(stream)) {
  console.log(row);
}

Types

interface ParseOptions {
  delimiter?: string;
  newline?: string;
  quoteChar?: string;
  escapeChar?: string;
  header?: boolean;
  skipEmptyLines?: boolean;
}

interface ParseResult<T = Record<string, string>> {
  data: T[];
  errors: Array<{ row: number; message: string }>;
  meta: { fields?: string[]; rowCount: number };
}

interface StringifyOptions {
  delimiter?: string;
  newline?: string;
  quoteChar?: string;
  header?: boolean;
}

License

MIT © Input Kit