Created
April 2, 2015 05:51
-
-
Save gabhi/f7d24f850ffa9c2770e5 to your computer and use it in GitHub Desktop.
CSV to JSON node js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Converter=require("csvtojson").core.Converter; | |
| var csvConverter=new Converter({constructResult:false, toArrayString:true}); // The constructResult parameter=false will turn off final result construction in memory for stream feature. toArrayString will stream out a normal JSON array object. | |
| var readStream=require("fs").createReadStream("top-1m.csv"); | |
| var writeStream=require("fs").createWriteStream("outpuData.json"); | |
| readStream.pipe(csvConverter).pipe(writeStream); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment