tty-table 4.2.1 → 4.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -111,15 +111,21 @@ const runTable = function (header, body) {
111
111
  previousHeight = t1.height
112
112
  }
113
113
 
114
+ const chunks = []
114
115
  process.stdin.resume()
115
116
  process.stdin.setEncoding("utf8")
116
117
  process.stdin.on("data", function (chunk) {
118
+ chunks.push(chunk)
119
+ })
120
+ process.stdin.on("end", function () {
121
+ const stdin = chunks.join("")
122
+
117
123
  // handle dataFormats
118
124
  switch (true) {
119
125
  case (dataFormat === "json"):
120
126
  let data
121
127
  try {
122
- data = JSON.parse(chunk)
128
+ data = JSON.parse(stdin)
123
129
  } catch (e) {
124
130
  emitError(
125
131
  "JSON parse error",
@@ -136,7 +142,7 @@ process.stdin.on("data", function (chunk) {
136
142
  }
137
143
  })
138
144
 
139
- csv.parse(chunk, formatterOptions, function (err, data) {
145
+ csv.parse(stdin, formatterOptions, function (err, data) {
140
146
  // validate csv
141
147
  if (err || typeof data === "undefined") {
142
148
  emitError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tty-table",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "description": "Node cli table",
5
5
  "main": "src/main.js",
6
6
  "types": "src/factory.d.ts",
package/src/factory.d.ts CHANGED
@@ -41,6 +41,7 @@ declare namespace TtyTable {
41
41
  errorOnNull?: boolean;
42
42
  truncate?: string | boolean;
43
43
  width?: string;
44
+ footerColor?: string;
44
45
  }
45
46
 
46
47
  export interface Config extends Options {