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

@alesmenzel/csv

v1.5.0

Published

CSV parser

Readme

@alesmenzel/csv

CI

Simple and elegant streaming csv parser.

Handles formats defined by RFC4180 but also works with format produced by PHP's fputcsv. Note in mind, that there is no defacto standard for CSV and different csv libraries create slightly different versions, for example some of them

  • use comments in csv # this is a comment (see relaxComments and comment options)
  • use escaping character instead of double quoting "\"" (this is valid csv cell in PHP's version, handled by default)
  • use blank spaces after quoted fields "abc" ,"cde" (see relaxCharactersAfterQuotedText option)
  • output different column count per each row (see relaxColumnCount option)
  • Byte Order Mark (BOM) at the start of CSV (see bom option)
  • do not contain the row delimiter (e.g. newline) on the last row (handled by default)

By default we are very strict about parsing the CSV, but can use the relax* rules to lower the bar.

Installation

npm i --save @alesmenzel/csv

Usage

const createCSVParser = require('@alesmenzel/csv')

const csv = new createCSVParser({
  // delimiter: ',' (default)
  // quote: '"' (default)
  // rowDelimiter: '\n' (default) - handles \r\n as well
  // escape: '\\' (default)
  // ... and other (see options below)
  // ... you can pass Transform stream options here - e.g. highWaterMark
})

const rows = []
csv.on('data', (row) => {
  rows.push(row)
})

csv.on('end', () => {
  console.log(rows)
})

csv.write('A,B,C\n')
csv.write('a,b,c\n')
csv.end('x,"Joe ""The Death"" Black",z\n')

Options

| Option | Description | Default Value | | -------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------------- | | delimiter | Single character that is used to delimit the cells in a row. | , | | rowDelimiter | Single character that is used to delimit the rows in the input. | \n (optionally preceded by \r) | | quote | Single character that is used to quote the value of a cell. | " | | escape | Single character that is used to escape a character inside the cell. | \ | | comment | Single character that is used to define a comment line. | # | | bom | Strip BOM from the first line of CSV if present. | true | | relaxComments | Allow comments in CSV. Comments are lines that start with the comment character. | false | | relaxCharactersAfterQuotedText | Allow extranious characters after end of quoted cell, but those extra characters are ignored. | false | | relaxComments | Allow comments in CSV. Comments are lines that start with the comment character. | false | | relaxColumnCount | Allow inconsistent column count per each row. | false | | highWaterMark and other transform stream options | Other options are passed to the underlaying Transform stream. | - |

Events

Besides the standard stream events, we emit the following:

Event "comment" (comment: string)

When a comment line is found. The payload is the actual comment string without the comment character (e.g. #).

csv.on('comment', (comment: string) => {
  // ...
})

Licence

This package is developed under the MIT licence.