Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm's 300,000 packages pre-installed, including babyparse with all npm packages installed. Try it out:

var babyparse = require("babyparse")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

babyparse v0.4.6

Fast and reliable CSV parser based on PapaParse

Baby Parse

Fast and reliable CSV parser based on Papa Parse. Papa Parse is for the browser, Baby Parse is for Node.js.

This package has all the functionality of Papa Parse except for web workers and parsing directly from files. You can pass a string to Baby Parse and use any of the other config options as described in the Papa Parse documentation.

Installation

// simply install using npm
npm install babyparse

Basic Usage

// pass in the contents of a csv file
parsed = Baby.parse(csv);

// voila
rows = parsed.data;

Parse File(s)

Baby Parse will assume the input is a filename if it ends in .csv or .txt.

// Parse single file
parsed = Baby.parseFiles(file[, config])

rows = parsed.data
// Parse multiple files
// Files can be either an array of strings or objects { file: filename[, config: config] }
// When using and array of objects and you include a config it will be used in place of the global config
parsed = Baby.parseFiles(files[, globalConfig])

rows = parsed[index].data

For a complete understanding of the power of this library, please refer to the Papa Parse web site.

Credits

Rich Harris forked Papa Parse to make Baby Parse. Matt Holt (the author of Papa Parse) helps maintain this fork.

License

The original PapaParse is MIT licensed. So is BabyParse.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free