File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,29 @@ In order for the inputEncoding option to take effect you need to install [iconv-
7373Also, take a look at the iconv-lite documentation for supported encodings.
7474(iconv-lite provides pure javascript character encoding conversion -> no native code compilation)
7575
76+ ## CLI
77+
78+ To use on the command line install it globally:
79+
80+ ``` bash
81+ $ npm install csv-streamify -g
82+ ```
83+
84+ This should add the ` csv-streamify ` command to your ` $PATH ` .
85+
86+ Then, you either pipe data into it or give it a filename:
87+
88+ ``` bash
89+ # pipe data in
90+ $ cat some_data.csv | csv-streamify
91+ # pass a filename
92+ $ csv-streamify some_data.csv > output.json
93+ # tell csv-streamify to read from + wait on stdin
94+ $ csv-streamify -
95+ ```
96+
7697## Wishlist
7798
78- - CLI
7999- browser support
80100
81101If you would like to contribute either of those just open an issue so we can discuss it further. :)
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ var csv = require ( './csv-streamify' )
4+
5+ var arg = process . argv [ 2 ]
6+ var opts = { encoding : 'utf8' }
7+
8+ if ( ! process . stdin . isTTY || arg === '-' ) {
9+ process . stdin . pipe ( csv ( opts ) ) . pipe ( process . stdout )
10+ } else {
11+ var fs = require ( 'fs' )
12+ fs . createReadStream ( arg ) . pipe ( csv ( opts ) ) . pipe ( process . stdout )
13+ }
Original file line number Diff line number Diff line change 1010 "scripts" : {
1111 "test" : " ./node_modules/.bin/mocha -R spec"
1212 },
13+ "bin" : {
14+ "csv-streamify" : " cli.js"
15+ },
1316 "repository" : " https://github.com/klaemo/csv-stream" ,
1417 "keywords" : [
1518 " csv" ,
You can’t perform that action at this time.
0 commit comments