All Projects → klaemo → Csv Stream

klaemo / Csv Stream

Licence: other
📃 Streaming CSV Parser for Node. Small and made entirely out of streams.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Csv Stream

Fast Csv
CSV parser and formatter for node
Stars: ✭ 1,054 (+975.51%)
Mutual labels:  stream, csv, csv-parser
React Papaparse
react-papaparse is the fastest in-browser CSV (or delimited text) parser for React. It is full of useful features such as CSVReader, CSVDownloader, readString, jsonToCSV, readRemoteFile, ... etc.
Stars: ✭ 116 (+18.37%)
Mutual labels:  stream, csv, csv-parser
Jsoncons
A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
Stars: ✭ 400 (+308.16%)
Mutual labels:  csv, csv-parser
Vroom
Fast reading of delimited files
Stars: ✭ 462 (+371.43%)
Mutual labels:  csv, csv-parser
Filehelpers
The FileHelpers are a free and easy to use .NET library to read/write data from fixed length or delimited records in files, strings or streams
Stars: ✭ 917 (+835.71%)
Mutual labels:  csv, csv-parser
Awesomecsv
🕶️A curated list of awesome tools for dealing with CSV.
Stars: ✭ 305 (+211.22%)
Mutual labels:  csv, csv-parser
Csv Parser
A modern C++ library for reading, writing, and analyzing CSV (and similar) files.
Stars: ✭ 359 (+266.33%)
Mutual labels:  csv, csv-parser
Iostreams
IOStreams is an incredibly powerful streaming library that makes changes to file formats, compression, encryption, or storage mechanism transparent to the application.
Stars: ✭ 84 (-14.29%)
Mutual labels:  stream, csv
pcap-processor
Read and process pcap files using this nifty tool
Stars: ✭ 36 (-63.27%)
Mutual labels:  csv, stream
Faster Than Csv
Faster CSV on Python 3
Stars: ✭ 52 (-46.94%)
Mutual labels:  csv, csv-parser
Csv
Fast C# CSV parser
Stars: ✭ 53 (-45.92%)
Mutual labels:  csv, csv-parser
text2json
Performant parser for textual data (CSV parser)
Stars: ✭ 33 (-66.33%)
Mutual labels:  csv, stream
VBA-CSV-interface
The most powerful and comprehensive CSV/TSV/DSV data management library for VBA, providing parsing/writing capabilities compliant with RFC-4180 specifications and a complete set of tools for manipulating records and fields.
Stars: ✭ 24 (-75.51%)
Mutual labels:  csv, csv-parser
Csv
CSV Decoding and Encoding for Elixir
Stars: ✭ 398 (+306.12%)
Mutual labels:  stream, csv
flatpack
CSV/Tab Delimited and Fixed Length Parser and Writer
Stars: ✭ 55 (-43.88%)
Mutual labels:  csv, csv-parser
Csvutil
csvutil provides fast and idiomatic mapping between CSV and Go (golang) values.
Stars: ✭ 501 (+411.22%)
Mutual labels:  csv, csv-parser
Ngx Papaparse
Papa Parse wrapper for Angular
Stars: ✭ 83 (-15.31%)
Mutual labels:  csv, csv-parser
csvtogs
Take a CSV file and create a Google Spreadsheet with the contents
Stars: ✭ 15 (-84.69%)
Mutual labels:  csv, csv-parser
CsvTextFieldParser
A simple CSV parser based on Microsoft.VisualBasic.FileIO.TextFieldParser.
Stars: ✭ 40 (-59.18%)
Mutual labels:  csv, csv-parser
Clevercsv
CleverCSV is a Python package for handling messy CSV files. It provides a drop-in replacement for the builtin CSV module with improved dialect detection, and comes with a handy command line application for working with CSV files.
Stars: ✭ 887 (+805.1%)
Mutual labels:  csv, csv-parser

csv-streamify Build Status Greenkeeper badge

NPM

Parses csv files. Accepts options. No coffee script, no weird APIs. Just streams. Tested against csv-spectrum and used in production. It is also "fast enough" (around 60,000 rows per second, but that varies with data obviously).

Works in node 4, 6, 8 and 9. Might work in earlier versions, but is not tested in it.

Installation

npm install csv-streamify

Usage

This module implements a simple node stream.Transform stream. You can write to it, read from it and use .pipe as you would expect.

const csv = require('csv-streamify')
const fs = require('fs')

const parser = csv()

// emits each line as a buffer or as a string representing an array of fields
parser.on('data', function (line) {
  console.log(line)
})

// now pipe some data into it
fs.createReadStream('/path/to/file.csv').pipe(parser)

with options and callback

The first argument can either be an options object (see below) or a callback function.

Note: If you pass a callback to csv-streamify it will buffer the parsed data for you and pass it to the callback when it's done. This behaviour can obviously lead to out of memory errors with very large csv files.

const csv = require('csv-streamify')
const fs = require('fs')

const parser = csv({ objectMode: true }, function (err, result) {
  if (err) throw err
  // our csv has been parsed succesfully
  result.forEach(function (line) { console.log(line) })
})

// now pipe some data into it
fs.createReadStream('/path/to/file.csv').pipe(parser)

Options

You can pass some options to the parser. All of them are optional.

The options are also passed to the underlying transform stream, so you can pass in any standard node core stream options.

{
  delimiter: ',', // comma, semicolon, whatever
  newline: '\n', // newline character (use \r\n for CRLF files)
  quote: '"', // what's considered a quote
  empty: '', // empty fields are replaced by this,

  // if true, emit arrays instead of stringified arrays or buffers
  objectMode: false,

  // if set to true, uses first row as keys -> [ { column1: value1, column2: value2 }, ...]
  columns: false
}

Also, take a look at iconv-lite (npm install iconv-lite --save), it provides pure javascript streaming character encoding conversion.

CLI

To use on the command line install it globally:

$ npm install csv-streamify -g

This should add the csv-streamify command to your $PATH.

Then, you either pipe data into it or give it a filename:

# pipe data in
$ cat some_data.csv | csv-streamify
# pass a filename
$ csv-streamify some_data.csv > output.json
# tell csv-streamify to read from + wait on stdin
$ csv-streamify -

Wishlist

  • browser support
  • better CLI

If you would like to contribute either of those just open an issue so we can discuss it further. :)

Contributors

Nicolas Hery (objectMode)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].