{"version":"4.4.2","name":"csv-generate","description":"CSV and object generation implementing the Node.js `stream.Readable` API","keywords":["stream","generate","csv","object","backend","frontend"],"bugs":"https://github.com/adaltas/node-csv-generate/issues","author":"David Worms <david@adaltas.com> (https://www.adaltas.com)","devDependencies":{"@eslint/js":"^9.15.0","@rollup/plugin-node-resolve":"^15.3.0","@types/mocha":"^10.0.9","@types/node":"^22.9.1","coffeescript":"~2.7.0","each":"^2.7.2","eslint":"^9.15.0","eslint-config-prettier":"^9.1.0","eslint-plugin-mocha":"^10.5.0","eslint-plugin-prettier":"^5.2.1","mocha":"~10.8.2","prettier":"^3.3.3","rollup":"^4.27.3","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-node-globals":"^1.4.0","should":"~13.2.3","ts-node":"^10.9.2","typescript":"^5.6.3"},"exports":{".":{"import":{"types":"./lib/index.d.ts","default":"./lib/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}},"./sync":{"import":{"types":"./lib/sync.d.ts","default":"./lib/sync.js"},"require":{"types":"./dist/cjs/sync.d.cts","default":"./dist/cjs/sync.cjs"}},"./stream":{"import":{"types":"./lib/stream.d.ts","default":"./lib/stream.js"},"require":{"types":"./dist/cjs/stream.d.cts","default":"./dist/cjs/stream.cjs"}},"./browser/esm":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"./browser/esm/sync":{"types":"./dist/esm/sync.d.ts","default":"./dist/esm/sync.js"}},"homepage":"https://csv.js.org/generate","license":"MIT","main":"./dist/cjs/index.cjs","mocha":{"inline-diffs":true,"loader":"./test/loaders/all.js","recursive":true,"reporter":"spec","require":["should"],"throw-deprecation":false,"timeout":40000},"lint-staged":{"*.js":"npm run lint:fix","*.md":"prettier -w"},"repository":{"type":"git","url":"https://github.com/adaltas/node-csv.git","directory":"packages/csv-generate"},"scripts":{"build":"npm run build:rollup && npm run build:ts","build:rollup":"npx rollup -c","build:ts":"cp lib/index.d.ts dist/cjs/index.d.cts && cp lib/stream.d.ts dist/cjs/stream.d.cts && cp lib/sync.d.ts dist/cjs/sync.d.cts && cp lib/*.ts dist/esm","postbuild:ts":"find dist/cjs -name '*.d.cts' -exec sh -c \"sed -i \"s/\\.js'/\\.cjs'/g\" {} || sed -i '' \"s/\\.js'/\\.cjs'/g\" {}\" \\;","lint:check":"eslint","lint:fix":"eslint --fix","lint:ts":"tsc --noEmit true","preversion":"npm run build && git add dist","test":"mocha 'test/**/*.{coffee,ts}'","test:legacy":"mocha --ignore test/api.web_stream.coffee --loader=./test/loaders/legacy/all.js 'test/**/*.{coffee,ts}'"},"type":"module","types":"dist/esm/index.d.ts","typesVersions":{"*":{".":["dist/esm/index.d.ts"],"sync":["dist/esm/sync.d.ts"],"browser/esm":["dist/esm/index.d.ts"],"browser/esm/sync":["dist/esm/sync.d.ts"]}},"gitHead":"cc1235a58de98dd9eab0665c7b1d03213e9633c7","_nodeVersion":"22.11.0","_npmVersion":"lerna/8.1.9/node@v22.11.0+x64 (linux)","_id":"csv-generate@4.4.2","dist":{"integrity":"sha512-W6nVsf+rz0J3yo9FOjeer7tmzBJKaTTxf7K0uw6GZgRocZYPVpuSWWa5/aoWWrjQZj4/oNIKTYapOM7hiNjVMA==","shasum":"001d7eda4993a72d24f73e15c9b9d7b251af8a2e","tarball":"http://registry-npm.ywwl.com/csv-generate/download/csv-generate-4.4.2.tgz","fileCount":29,"unpackedSize":1198245,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJPy4PIr2t8po4lwiowLPAUeztuKl2+9zJpJt1lyIK9gIgE2cX0vFzgBqybFVyg8UzPsoloiBYPLL7xd339eeBFI4="}],"size":261232,"noattachment":false,"key":"/csv-generate/-/csv-generate-4.4.2.tgz"},"_npmUser":{"name":"david","email":"david@adaltas.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/csv-generate_4.4.2_1732180283821_0.2685854275941131"},"_hasShrinkwrap":false,"readme":"# CSV generator for Node.js and the web\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/adaltas/node-csv/nodejs.yml?branch=master)](https://github.com/adaltas/node-csv/actions)\n[![NPM](https://img.shields.io/npm/dm/csv-generate)](https://www.npmjs.com/package/csv-generate)\n[![NPM](https://img.shields.io/npm/v/csv-generate)](https://www.npmjs.com/package/csv-generate)\n\nThe [`csv-generate` package](https://csv.js.org/generate/) provides a flexible generator of random CSV strings and Javascript objects implementing the Node.js `stream.Readable` API. It is part of the [CSV project](https://csv.js.org/).\n\n## Documentation\n\n- [Project homepage](https://csv.js.org/generate/)\n- [API](https://csv.js.org/generate/api/)\n- [Options](https://csv.js.org/generate/options/)\n- [Examples](https://csv.js.org/generate/examples/)\n\n## Main features\n\n- Scalable `stream.Readable` implementation\n- random or pseudo-random seed based generation\n- Idempotence with the \"seed\" option\n- User-defined value generation\n- Multiple types of values (integer, boolean, dates, ...)\n- MIT License\n\n## Usage\n\nRun `npm install csv` to install the full CSV module or run `npm install csv-generate` if you are only interested by the CSV generator.\n\nUse the callback and sync APIs for simplicity or the stream based API for scalability.\n\n## Example\n\nThe [API](https://csv.js.org/generate/api/) is available in multiple flavors. This example illustrates the stream API.\n\n```js\nimport { generate } from \"csv-generate\";\nimport assert from \"assert\";\n\nconst records = [];\n// Initialize the generator\ngenerate({\n  seed: 1,\n  objectMode: true,\n  columns: 2,\n  length: 2,\n})\n  // Use the readable stream api to consume generated records\n  .on(\"readable\", function () {\n    let record;\n    while ((record = this.read()) !== null) {\n      records.push(record);\n    }\n  })\n  // Catch any error\n  .on(\"error\", function (err) {\n    console.error(err);\n  })\n  // Test that the generated records matched the expected records\n  .on(\"end\", function () {\n    assert.deepEqual(records, [\n      [\"OMH\", \"ONKCHhJmjadoA\"],\n      [\"D\", \"GeACHiN\"],\n    ]);\n  });\n```\n\n## Development\n\nTests are executed with [Mocha](https://mochajs.org/). To install it, simple run `npm install` followed by `npm test`. It will install mocha and its dependencies in your project \"node_modules\" directory and run the test suite. The tests run against the CoffeeScript source files.\n\nTo generate the JavaScript files, run `npm run coffee`.\n\nThe test suite is run online with [Travis](https://travis-ci.org/#!/adaltas/node-csv-generate). See the [Travis definition file](https://github.com/adaltas/node-csv-generate/blob/master/.travis.yml) to view the tested Node.js version.\n\n## Contributors\n\nThe project is sponsored by [Adaltas](https://www.adaltas.com), an Big Data consulting firm based in Paris, France.\n\n- David Worms: <https://github.com/wdavidw>\n","publish_time":1732180284094,"maintainers":[{"name":"david","email":"david@adaltas.com"}],"_cnpm_publish_time":1732180284094,"dist-tags":{"latest":"4.6.2"}}