File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 4
4
JSONstat=require("jsonstat-toolkit"),
5
5
6
6
dataset=function(contents){
7
+ var json;
8
+
7
9
try{
8
- var json=JSON.parse(contents);
10
+ json=JSON.parse(contents);
9
11
}catch (e){
10
12
console.error("Error: The input does not containt JSON.");
11
13
process.exit(1);
66
68
console.log("Warning: Using " + output + " instead.");
67
69
}
68
70
69
- if(fs.writeFileSync(output, content, "utf8")===false){
70
- console.error("Error: Couldn't create " + output + ".");
71
- process.exit(1);
71
+ //So far, only in the non-stream interface...
72
+ if(Array.isArray(content)){
73
+ content.forEach(function(item){
74
+ fs.writeFileSync(output, item+"\n", { flag: "a+" });
75
+ });
76
+ }else{
77
+ if(fs.writeFileSync(output, content, "utf8")===false){
78
+ console.error("Error: Couldn't create " + output + ".");
79
+ process.exit(1);
80
+ }
72
81
}
73
82
74
83
console.log("Success: " + output + " has been created.");
Original file line number Diff line number Diff line change 39
39
csv = utils . toCSV (
40
40
inout . dataset ( contents ) ,
41
41
{
42
+ array : argv . stream ? false : true , //big datasets experimentally when interface is not stream (weird)
42
43
rich : argv . rich ,
43
44
status : argv . status ,
44
45
vlabel : argv . vlabel ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " jsonstat-conv" ,
3
- "version" : " 1.3.1 " ,
3
+ "version" : " 1.3.2 " ,
4
4
"description" : " JSON-stat Command Line Conversion Tools" ,
5
5
"homepage" : " https://github.com/jsonstat/conv" ,
6
6
"keywords" : [
39
39
},
40
40
"license" : " Apache-2.0" ,
41
41
"dependencies" : {
42
- "jsonstat-suite" : " ^3.1.7 " ,
42
+ "jsonstat-suite" : " ^3.2.2 " ,
43
43
"jsonstat-toolkit" : " ^1.3.1" ,
44
44
"rw" : " ^1.3.3" ,
45
45
"yargs" : " ^15.1.0"
You can’t perform that action at this time.
0 commit comments