papaparse
Fast, powerful CSV parser for JavaScript — handles large files via streaming, auto-detects delimiters, and works in browsers and Node.js.
papaparse
General JSFast, powerful CSV parser for JavaScript — handles large files via streaming, auto-detects delimiters, and works in browsers and Node.js.
Fit
Bundle (gzip)
7.0 kB
19.3 kB raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Parsing CSV files correctly requires handling quoted fields with commas, escaped quotes, multiline fields, different delimiters, and inconsistent line endings. Naive string splitting breaks on the first edge case.
What It Does
PapaParse handles all CSV edge cases correctly, auto-detects delimiters, casts numbers and booleans, and maps headers to object keys. For large files, streaming mode processes rows without loading the entire file into memory. It also converts arrays/objects back to CSV strings.
Installation
npm install papaparse
npm install -D @types/papaparseUsage Example
import Papa from 'papaparse';
import { createReadStream } from 'fs';
// Parse a CSV string
const { data } = Papa.parse<{ name: string; age: string }>(csvString, {
header: true,
skipEmptyLines: true,
dynamicTyping: true, // auto-cast numbers/booleans
});
// Stream a large file
Papa.parse(createReadStream('large.csv'), {
header: true,
step: (row) => processRow(row.data),
complete: () => console.log('Done'),
});
// Convert objects to CSV
const csv = Papa.unparse([{ name: 'Alice', age: 30 }, { name: 'Bob', age: 25 }]);Related packages
Unified TypeScript SDK for building AI-powered apps — switch between 20+ LLM providers without rewriting code.
animejsGeneral JSLightweight JavaScript animation library with a tiny footprint and a powerful, expressive API.
AOSGeneral JSAn easy-to-use library that makes elements fade, slide, or zoom into view as the user scrolls down your page.
archiverGeneral JSStreaming interface for generating ZIP and TAR archives in Node.js — create compressed archives programmatically from files, directories, and buffers.
@formkit/auto-animateGeneral JS> Add smooth transitions to any element with a single line — zero-config animations for adds, removes, and moves.