{"id":13589,"library":"neat-csv","title":"neat-csv","description":"neat-csv is a lightweight, promise-based wrapper around the high-performance streaming `csv-parser` module, designed for quickly parsing CSV data from strings, buffers, or readable streams into an array of JavaScript objects. The current stable version is 7.0.0. While `csv-parser` focuses on stream-based processing, `neat-csv` offers a convenient, promise-returning API, making it ideal for scenarios where the entire CSV content is available upfront or can be easily buffered. Its release cadence is tied to updates in Node.js compatibility and significant changes in its underlying `csv-parser` dependency. A key differentiator is its straightforward API for non-streaming use cases, abstracting away stream handling complexities while retaining the performance benefits of its core parser. Since version 7.0.0, the package is pure ESM, requiring modern Node.js environments and import syntax.","status":"active","version":"7.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/sindresorhus/neat-csv","tags":["javascript","parse","csv","comma","separated","values","tab","delimiter","separator"],"install":[{"cmd":"npm install neat-csv","lang":"bash","label":"npm"},{"cmd":"yarn add neat-csv","lang":"bash","label":"yarn"},{"cmd":"pnpm add neat-csv","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"neat-csv is a convenience wrapper around this core CSV streaming parser; parsing-related issues are often rooted here.","package":"csv-parser"}],"imports":[{"note":"Since v7.0.0, neat-csv is a pure ESM package. CommonJS `require()` is no longer supported.","wrong":"const neatCsv = require('neat-csv');","symbol":"neatCsv","correct":"import neatCsv from 'neat-csv';"},{"note":"The `Options` type defines the configuration object for parsing, matching `csv-parser`'s options. Use `import type` to ensure it's a type-only import and avoids potential runtime issues.","wrong":"import { Options } from 'neat-csv';","symbol":"Options","correct":"import type { Options } from 'neat-csv';"}],"quickstart":{"code":"import neatCsv from 'neat-csv';\nimport { Readable } from 'node:stream';\n\nasync function runParsingExamples() {\n  // Example 1: Parsing a simple CSV string\n  const csvString = 'header1,header2\\nvalueA1,valueA2\\nvalueB1,valueB2';\n  console.log('--- Parsing from string ---');\n  console.log(await neatCsv(csvString));\n  // Expected: [{ header1: 'valueA1', header2: 'valueA2' }, { header1: 'valueB1', header2: 'valueB2' }]\n\n  // Example 2: Parsing a CSV buffer\n  const csvBuffer = Buffer.from('name,age\\nAlice,30\\nBob,24');\n  console.log('\\n--- Parsing from buffer ---');\n  console.log(await neatCsv(csvBuffer));\n  // Expected: [{ name: 'Alice', age: '30' }, { name: 'Bob', age: '24' }]\n\n  // Example 3: Parsing a CSV from a Readable stream\n  const streamData = ['product,price', 'Laptop,1200', 'Mouse,25'].join('\\n');\n  const csvStream = Readable.from(streamData);\n  console.log('\\n--- Parsing from stream ---');\n  console.log(await neatCsv(csvStream));\n  // Expected: [{ product: 'Laptop', price: '1200' }, { product: 'Mouse', price: '25' }]\n\n  // Example 4: Using options (e.g., custom delimiter) - neat-csv passes options directly to csv-parser\n  const tsvString = 'id\\tlabel\\n1\\tItem A\\n2\\tItem B';\n  console.log('\\n--- Parsing TSV with delimiter option ---');\n  console.log(await neatCsv(tsvString, { separator: '\\t' }));\n  // Expected: [{ id: '1', label: 'Item A' }, { id: '2', label: 'Item B' }]\n}\n\nrunParsingExamples().catch(console.error);","lang":"typescript","description":"Demonstrates parsing CSV data from strings, buffers, and Node.js readable streams, including passing options for custom delimiters."},"warnings":[{"fix":"Migrate your project to use ES modules (`\"type\": \"module\"` in `package.json` or `.mjs` files) and use `import neatCsv from 'neat-csv';`.","message":"Version 7.0.0 and newer are pure ESM (ECMAScript Modules). CommonJS `require()` is no longer supported. Projects must be configured for ESM or use an older version of the package.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Upgrade your Node.js runtime to version 12.20.0, 14.13.1, 16.0.0, or newer.","message":"Node.js 12.20.0 or higher is required for version 7.0.0. Ensure your Node.js environment meets this minimum requirement.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Upgrade your Node.js runtime to version 10 or newer.","message":"Node.js 10 or higher is required for version 6.0.0. Older Node.js versions are not supported.","severity":"breaking","affected_versions":">=6.0.0 <7.0.0"},{"fix":"Before opening an issue for `neat-csv`, check the `csv-parser` repository for existing issues or report it there if it's a core parsing problem.","message":"Parsing-related issues, such as incorrect data interpretation or parsing errors, should primarily be reported to the upstream `csv-parser` package, as `neat-csv` acts as a thin wrapper.","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Upgrade to `neat-csv` v5.2.0 or newer to take full advantage of generic TypeScript row typing.","message":"The `Row` TypeScript return type was made generic in v5.2.0. Older versions might not fully support specific row typing.","severity":"deprecated","affected_versions":"<5.2.0"}],"env_vars":null,"search_vec":"'7.0.0':47,135 'abstract':119 'api':67,112 'around':14 'array':38 'avail':79 'away':120 'base':12,56 'benefit':128 'buffer':32,85 'cadenc':88 'case':118 'chang':98 'comma':151 'compat':95 'complex':123 'content':77 'conveni':63 'core':131 'csv':3,6,21,28,50,60,76,103,150 'csv-parser':20,49,102 'current':43 'data':29 'delimit':155 'depend':105 'design':24 'differenti':108 'easili':84 'entir':75 'environ':144 'esm':140 'focus':52 'handl':122 'high':17 'high-perform':16 'ideal':70 'import':146 'javascript':40,148 'key':107 'lightweight':9 'make':68 'modern':142 'modul':23 'neat':2,5,59 'neat-csv':1,4,58 'node.js':94,143 'non':115 'non-stream':114 'object':41 'offer':61 'packag':137 'pars':27,149 'parser':22,51,104,132 'perform':18,127 'process':57 'promis':11,65 'promise-bas':10 'promise-return':64 'pure':139 'quick':26 'readabl':34 'releas':87 'requir':141 'retain':125 'return':66 'scenario':72 'separ':152,156 'signific':97 'sinc':133 'stabl':44 'straightforward':111 'stream':19,35,55,116,121 'stream-bas':54 'string':31 'syntax':147 'tab':154 'tie':90 'under':101 'updat':92 'upfront':80 'use':117 'valu':153 'version':45,134 'wrapper':13","created_at":"2026-04-20T01:55:17.133828+00:00","updated_at":"2026-04-20T01:55:17.133828+00:00","problems":[{"fix":"Switch to ES module import syntax: `import neatCsv from 'neat-csv';` and ensure your project is configured for ESM.","cause":"Attempting to use `require()` to import `neat-csv` in a CommonJS module after version 7.0.0.","error":"ERR_REQUIRE_ESM"},{"fix":"Ensure you are using `import neatCsv from 'neat-csv';` for ESM projects and that your Node.js version meets the package requirements.","cause":"This usually indicates an incorrect import statement (e.g., trying to named import a default export) or a Node.js version incompatibility preventing the module from loading correctly.","error":"TypeError: neatCsv is not a function"},{"fix":"Add `\"type\": \"module\"` to your `package.json` file or rename your file to `.mjs` to explicitly declare it as an ES module.","cause":"Attempting to use `import` syntax in a Node.js environment that is treating the file as CommonJS (e.g., missing `\"type\": \"module\"` in `package.json` or not using `.mjs` extension).","error":"Uncaught SyntaxError: Cannot use 'import' statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/sindresorhus/neat-csv","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/neat-csv","openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}