Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "csv-cli", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A CLI wrapper around the node csv package", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -39,11 +39,15 @@ const { Transform } = require("stream"); | ||
const convertChunk = (chunk) => { | ||
if (Buffer.isBuffer(chunk)) { | ||
return chunk.toString(); | ||
} | ||
else { | ||
return chunk; | ||
} | ||
} | ||
return new Transform({ | ||
objectMode: true, | ||
transform(chunk, encoding, callback) { | ||
if (Buffer.isBuffer(chunk)) { | ||
data += chunk.toString(); | ||
} | ||
else { | ||
data += chunk; | ||
} | ||
data += convertChunk(chunk); | ||
@@ -54,4 +58,11 @@ callback(); | ||
try { | ||
this.push(JSON.parse(data)); | ||
const json = JSON.parse(data); | ||
if (Array.isArray(json)) { | ||
json.forEach(this.push.bind(this)); | ||
} | ||
else { | ||
this.push(json); | ||
} | ||
callback(); | ||
@@ -58,0 +69,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6476
164