{"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.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install neat-csv"],"cli":null},"imports":["import neatCsv from 'neat-csv';","import type { Options } from 'neat-csv';"],"auth":{"required":false,"env_vars":[]},"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}