@google-cloud/nodejs-common 2.4.1 → 2.4.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.
package/package.json
CHANGED
|
@@ -66,7 +66,6 @@ class RestSearchStreamTransform extends Transform {
|
|
|
66
66
|
if (endIndex > -1) {
|
|
67
67
|
this.chunks.push(chunk);
|
|
68
68
|
const rawString = Buffer.concat(this.chunks).toString();
|
|
69
|
-
const startIndex = rawString.indexOf(START_TAG) + START_TAG.length;
|
|
70
69
|
const maskIndex = rawString.lastIndexOf(FIELD_MASK_TAG);
|
|
71
70
|
if (!this.processFn) {
|
|
72
71
|
const fieldMask = rawString
|
|
@@ -82,11 +81,18 @@ class RestSearchStreamTransform extends Transform {
|
|
|
82
81
|
this.processFn = processFn;
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
let rows, data;
|
|
85
|
+
if (rawString.indexOf(START_TAG) === -1) { // no 'results'
|
|
86
|
+
rows = [];
|
|
87
|
+
data = '';
|
|
88
|
+
} else {
|
|
89
|
+
const startIndex = rawString.indexOf(START_TAG) + START_TAG.length;
|
|
90
|
+
const resultsWithTailing = rawString.substring(startIndex, maskIndex);
|
|
91
|
+
const results = resultsWithTailing.substring(
|
|
92
|
+
0, resultsWithTailing.lastIndexOf(','));
|
|
93
|
+
rows = JSON.parse(results);
|
|
94
|
+
data = rows.map(this.processFn).join('\n') + '\n';
|
|
95
|
+
}
|
|
90
96
|
// Clear cached chunks.
|
|
91
97
|
this.chunks = [latest.subarray(latest.indexOf(END_TAG) + END_TAG.length)];
|
|
92
98
|
|