csv-parser
Advanced tools
Comparing version
25
bin.js
#!/usr/bin/env node | ||
var minimist = require('minimist') | ||
var ldjson = require('ldjson-stream') | ||
var ndjson = require('ndjson') | ||
var fs = require('fs') | ||
@@ -32,8 +32,11 @@ var csv = require('./') | ||
'Usage: csv-parser [filename?] [options]\n\n' + | ||
' --headers,-h Explicitly specify csv headers as a comma separated list\n' + | ||
' --output,-o Set output file. Defaults to stdout\n' + | ||
' --separator,-s Set the separator character ("," by default)\n' + | ||
' --strict Require column length match headers length\n' + | ||
' --version,-v Print out the installed version\n' + | ||
' --help Show this help\n' | ||
' --headers,-h Explicitly specify csv headers as a comma separated list\n' + | ||
' --output,-o Set output file. Defaults to stdout\n' + | ||
' --separator,-s Set the separator character ("," by default)\n' + | ||
' --strict Require column length match headers length\n' + | ||
' --version,-v Print out the installed version\n' + | ||
' --outputSeparator Put between JSON items in the output (default \\n)\n' + | ||
' --beforeOutput Put at beginning of output (default nothing)\n' + | ||
' --afterOutput Put at end of output (default \\n)\n' + | ||
' --help Show this help\n' | ||
) | ||
@@ -55,2 +58,8 @@ process.exit(1) | ||
var serializeOpts = { | ||
separator: argv.outputSeparator, | ||
before: argv.beforeOutput, | ||
after: argv.afterOutput | ||
} | ||
input | ||
@@ -62,3 +71,3 @@ .pipe(csv({ | ||
})) | ||
.pipe(ldjson.serialize()) | ||
.pipe(ndjson.serialize(serializeOpts)) | ||
.pipe(output) |
{ | ||
"name": "csv-parser", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "Streaming CSV parser that aims for maximum speed as well as compatibility with the csv-spectrum test suite", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mafintosh/csv-parser" | ||
"url": "git+https://github.com/mafintosh/csv-parser.git" | ||
}, | ||
@@ -13,4 +13,4 @@ "dependencies": { | ||
"inherits": "^2.0.1", | ||
"ldjson-stream": "^1.1.0", | ||
"minimist": "^0.2.0" | ||
"minimist": "^0.2.0", | ||
"ndjson": "^1.4.0" | ||
}, | ||
@@ -46,3 +46,3 @@ "devDependencies": { | ||
"author": "mafintosh", | ||
"license": "BSD" | ||
"license": "BSD-3-Clause" | ||
} |
@@ -82,4 +82,12 @@ # csv-parser | ||
### Options | ||
You can specify these CLI flags to control the JSON serialization output format | ||
- `outputSeparator` - default `\n`, what to put between JSON items in the output | ||
- 'beforeOutput` - default empty, what to put at beginning of output | ||
- `afterOutput` - default `\n`, what to put at end of output | ||
## License | ||
MIT |
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
19725
3.65%0
-100%481
1.69%93
9.41%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed