node-csvtojson
node-csvtojson copied to clipboard
Errors printed to stdout
Various errors are printed to stdout instead of stderr.
For instance: https://github.com/Keyang/node-csvtojson/blob/8e444d154bb688d61b3552d3d55b7fc4a9d08a5a/bin/csvtojson.js#L100
Impact:
When piping the output of the csvtojson to a file, these errors are also pushed to the file. If printed to stderr, I would have seen and corrected my malformed commandline parameters.
These should be console.error(), and some should throw.
Repro:
cat file.csv | csvtojson --downstreamFormat line > file.json # Note the space instead of "=" before "line"
file.json contents:
unknown parameter line.
[
{"id":"fjnsto","title":"+1000 Immunity To COVID-19 (DON'T BE THIS GUY)","selftext":"","created_utc":"1584376447","subreddit_id":"2qh0u","subreddit_name":"pics"}
,
{"id":"fjnsey","title":"a playground in massachusetts","selftext":"","created_utc":"1584376402","subreddit_id":"2qh0u","subreddit_name":"pics"}
...
]