{"id":17449386,"url":"https://github.com/klaemo/csv-stream","last_synced_at":"2025-04-05T06:09:40.356Z","repository":{"id":4714732,"uuid":"5862733","full_name":"klaemo/csv-stream","owner":"klaemo","description":":page_with_curl: Streaming CSV Parser for Node. Small and made entirely out of streams.","archived":false,"fork":false,"pushed_at":"2023-04-14T21:24:38.000Z","size":534,"stargazers_count":103,"open_issues_count":15,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T05:09:19.063Z","etag":null,"topics":["csv","csv-parser","javascript","nodejs","stream"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/klaemo.png","metadata":{"files":{"readme":"Readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-09-18T20:39:26.000Z","updated_at":"2022-07-01T10:53:15.000Z","dependencies_parsed_at":"2023-07-05T17:15:45.100Z","dependency_job_id":null,"html_url":"https://github.com/klaemo/csv-stream","commit_stats":{"total_commits":146,"total_committers":8,"mean_commits":18.25,"dds":0.5410958904109588,"last_synced_commit":"8a98f3c5159cf4e4787dd0401390a519058641fb"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaemo%2Fcsv-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaemo%2Fcsv-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaemo%2Fcsv-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaemo%2Fcsv-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klaemo","download_url":"https://codeload.github.com/klaemo/csv-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294541,"owners_count":20915340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","csv-parser","javascript","nodejs","stream"],"created_at":"2024-10-17T21:37:36.680Z","updated_at":"2025-04-05T06:09:40.325Z","avatar_url":"https://github.com/klaemo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"csv-streamify [![Build Status](https://travis-ci.org/klaemo/csv-stream.svg?branch=master)](https://travis-ci.org/klaemo/csv-stream) [![Greenkeeper badge](https://badges.greenkeeper.io/klaemo/csv-stream.svg)](https://greenkeeper.io/)\n===\n\n[![NPM](https://nodei.co/npm/csv-streamify.png?downloadRank=true)](https://nodei.co/npm/csv-streamify/)\n\nParses csv files. Accepts options. No coffee script, no weird APIs. Just streams. Tested against [csv-spectrum](https://github.com/maxogden/csv-spectrum) and used in production.\nIt is also \"fast enough\" (around 60,000 rows per second, but that varies with data obviously).\n\nWorks in node `4`, `6`, `8` and `9`. Might work in earlier versions, but is not tested in it.\n\n## Installation\n\n```\nnpm install csv-streamify\n```\n\n## Usage\n\nThis module implements a simple node [stream.Transform](http://nodejs.org/api/stream.html#stream_class_stream_transform) stream.\nYou can write to it, read from it and use `.pipe` as you would expect.\n\n```javascript\nconst csv = require('csv-streamify')\nconst fs = require('fs')\n\nconst parser = csv()\n\n// emits each line as a buffer or as a string representing an array of fields\nparser.on('data', function (line) {\n  console.log(line)\n})\n\n// now pipe some data into it\nfs.createReadStream('/path/to/file.csv').pipe(parser)\n```\n\n### with options and callback\n\nThe first argument can either be an options object (see below) or a callback function.\n\n__Note:__ If you pass a callback to `csv-streamify` it will buffer the parsed data for you and\npass it to the callback when it's done. This behaviour can obviously lead to out of memory errors with very large csv files.\n\n```javascript\nconst csv = require('csv-streamify')\nconst fs = require('fs')\n\nconst parser = csv({ objectMode: true }, function (err, result) {\n  if (err) throw err\n  // our csv has been parsed succesfully\n  result.forEach(function (line) { console.log(line) })\n})\n\n// now pipe some data into it\nfs.createReadStream('/path/to/file.csv').pipe(parser)\n```\n\n### Options\n\nYou can pass some options to the parser. **All of them are optional**.\n\nThe options are also passed to the underlying transform stream, so you can pass in any standard node core stream options.\n\n```javascript\n{\n  delimiter: ',', // comma, semicolon, whatever\n  newline: '\\n', // newline character (use \\r\\n for CRLF files)\n  quote: '\"', // what's considered a quote\n  empty: '', // empty fields are replaced by this,\n\n  // if true, emit arrays instead of stringified arrays or buffers\n  objectMode: false,\n\n  // if set to true, uses first row as keys -\u003e [ { column1: value1, column2: value2 }, ...]\n  columns: false\n}\n```\n\nAlso, take a look at [iconv-lite](https://github.com/ashtuchkin/iconv-lite) (`npm install iconv-lite --save`), it provides pure javascript streaming character encoding conversion.\n\n## CLI\n\nTo use on the command line install it globally:\n\n```bash\n$ npm install csv-streamify -g\n```\n\nThis should add the `csv-streamify` command to your `$PATH`.\n\nThen, you either pipe data into it or give it a filename:\n\n```bash\n# pipe data in\n$ cat some_data.csv | csv-streamify\n# pass a filename\n$ csv-streamify some_data.csv \u003e output.json\n# tell csv-streamify to read from + wait on stdin\n$ csv-streamify -\n```\n\n## Wishlist\n\n- browser support\n- better CLI\n\nIf you would like to contribute either of those just open an issue so we can discuss it further. :)\n\n## Contributors\n\n[Nicolas Hery](https://github.com/nicolashery) (objectMode)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaemo%2Fcsv-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklaemo%2Fcsv-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaemo%2Fcsv-stream/lists"}