node-csv
node-csv copied to clipboard
User-defined value generation
How to generate user defined values
I'dont find how to add user definded values to the generator. How can i add my own calue gerators some like faker.js?
Please help out. Thx
With the column options, maybe this test will help you.
Thanks for the hint but it seems that is not support (anymore). The Typescript types are not supporting a function in the coulmuns array(see). I use the following code and get the message:
TypeError [ERR_INVALID_ARG_TYPE]: The "buf" argument must be an instance of Buffer, TypedArray, or DataView. Received an instance of Array
generate({
columns: [() => 'mydata'],
encoding: 'utf-8',
objectMode: true,
length: args.count,
}).pipe(process.stdout);
if i ignore typescript errors and use "objectMode:false" this will run as aspected.
Please reproduce and share a full sample with minimal code. I will enrich the tests and update the definition file accordingly.
i have a mini sample repo here
In the Typescript File the types are wrong. I hope this helps what is wrong with the types
Version 4.4.0 hopefully fixes your issue.