You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bin/options.json
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,10 @@
61
61
"--quiet": {
62
62
"desc": "If any error happens, quit the process quietly rather than log out the error. Default is false.",
63
63
"type": "boolean"
64
+
},
65
+
"--escape":{
66
+
"desc":"escape character used in quoted column. Default is double quote (\") according to RFC4108. Change to back slash (\\) or other chars for your own case.",
Copy file name to clipboardExpand all lines: dist/csvtojson.js
+92-45Lines changed: 92 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -18,8 +18,8 @@ var Worker = require("./Worker.js");
18
18
varutils=require("./utils.js");
19
19
varasync=require("async");
20
20
21
-
functionConverter(params){
22
-
Transform.call(this);//TODO what does this do? -->This calls the constructor of Transform and initialise anything the Transform needs.(like var initialisation)
21
+
functionConverter(params,options){
22
+
Transform.call(this,options);
23
23
var_param={
24
24
constructResult: true,//set to false to not construct result in memory. suitable for big csv data
25
25
delimiter: ',',// change the delimiter of csv columns. It is able to use an array to specify potencial delimiters. e.g. [",","|",";"]
@@ -46,11 +46,14 @@ function Converter(params) {
46
46
console.warn("Parameter should be a JSON object like {'constructResult':false}");
47
47
_param.constructResult=params;
48
48
}
49
+
this._options=options||{};
49
50
this.param=_param;
51
+
this.param._options=this._options;
50
52
this.resultObject=newResult(this);
51
53
this.pipe(this.resultObject);// it is important to have downstream for a transform otherwise it will stuck
headers: null,//an array of header strings. If noheader is false and headers is array, csv header will be ignored.
14
14
flatKeys: false,// Don't interpret dots and square brackets in header fields as nested object or array identifiers at all.
15
15
maxRowLength: 0,//the max character a csv row could have. 0 means infinite. If max number exceeded, parser will emit "error" of "row_exceed". if a possibly corrupted csv data provided, give it a number like 65535 so the parser wont consume memory. default: 0
16
-
checkColumn: false//whether check column number of a row is the same as headers. If column number mismatched headers number, an error of "mismatched_column" will be emitted.. default: false
16
+
checkColumn: false,//whether check column number of a row is the same as headers. If column number mismatched headers number, an error of "mismatched_column" will be emitted.. default: false
0 commit comments