implementing the Node.js
stream.Readable API. It may be used to generate
random or user driven data.
Source code for this project is available on GitHub.
- random or pseudo-random seed based generation
npm install csv to install the full csv module or run
npm install csv-generate if you are only interested by the CSV parser.
Use the callback style API for simplicity or the stream based API for scalability.
Options may include:
Period to run in milliseconds, default to 4 minutes.
Define the number of generated fields and the generation method. If columns is an integer, it corresponds to the number of fields. If it is an array, each element correspond to a field. If the field is a function, the function is expected to return a value, if a string, it call the registered function of the same name (eg
Generator.intfor the value "int"), current values are "ascii", "int" and "bool", more could be added by the user or on demand by opending a pull request. Default to 8 ascii columns.
Maximum number of characters per word. Default to 16.
Generate idempotent random characters if a number provided
Number of lines or records to generate.
Whether this stream should behave as a stream of objects. Meaning that stream.read(n) returns a single value instead of a Buffer of size n. Default=false
The maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource. Default=16kb
All options are optional.
Most of the generator is imported from its parent project CSV in a effort to split it between the generator, the parser, the transformer and the stringifier.