Skip to content

Instantly share code, notes, and snippets.

@tvhung83
Created March 29, 2019 07:09
Show Gist options
  • Save tvhung83/03da141a081b6d0dd9a69d1c8ed9f6f2 to your computer and use it in GitHub Desktop.
Save tvhung83/03da141a081b6d0dd9a69d1c8ed9f6f2 to your computer and use it in GitHub Desktop.
const generate = require('csv-generate')
const fs = require('fs')
const minimist = require('minimist')
let args = minimist(process.argv.slice(2), {
alias: {
f: 'file',
c: 'columns',
l: 'length'
}
})
const output = fs.createWriteStream(args.f)
generate({seed: 123456, columns: args.c, length: args.l}).pipe(output)
@tvhung83
Copy link
Author

Usage

$ npm i csv-generate minimist
$ node generator.js -f <output_file.csv> -c <column_number> -l <row_number>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment