@datapos/datapos-tool-csv-parse 0.0.66 → 0.0.68
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.
|
@@ -31,10 +31,10 @@ function Ze(t) {
|
|
|
31
31
|
return n === 1 ? (e = t[r - 1], i += P[e >> 2], i += P[e << 4 & 63], i += "==") : n === 2 && (e = (t[r - 2] << 8) + t[r - 1], i += P[e >> 10], i += P[e >> 4 & 63], i += P[e << 2 & 63], i += "="), o.push(i), o.join("");
|
|
32
32
|
}
|
|
33
33
|
function ve(t, e, r, n, i) {
|
|
34
|
-
var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, u = a >> 1, c = -7, h = r ? i - 1 : 0,
|
|
35
|
-
for (h +=
|
|
34
|
+
var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, u = a >> 1, c = -7, h = r ? i - 1 : 0, d = r ? -1 : 1, g = t[e + h];
|
|
35
|
+
for (h += d, o = g & (1 << -c) - 1, g >>= -c, c += f; c > 0; o = o * 256 + t[e + h], h += d, c -= 8)
|
|
36
36
|
;
|
|
37
|
-
for (s = o & (1 << -c) - 1, o >>= -c, c += n; c > 0; s = s * 256 + t[e + h], h +=
|
|
37
|
+
for (s = o & (1 << -c) - 1, o >>= -c, c += n; c > 0; s = s * 256 + t[e + h], h += d, c -= 8)
|
|
38
38
|
;
|
|
39
39
|
if (o === 0)
|
|
40
40
|
o = 1 - u;
|
|
@@ -46,8 +46,8 @@ function ve(t, e, r, n, i) {
|
|
|
46
46
|
return (g ? -1 : 1) * s * Math.pow(2, o - n);
|
|
47
47
|
}
|
|
48
48
|
function ht(t, e, r, n, i, o) {
|
|
49
|
-
var s, f, a, u = o * 8 - i - 1, c = (1 << u) - 1, h = c >> 1,
|
|
50
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s = c) : (s = Math.floor(Math.log(e) / Math.LN2), e * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + h >= 1 ? e +=
|
|
49
|
+
var s, f, a, u = o * 8 - i - 1, c = (1 << u) - 1, h = c >> 1, d = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = n ? 0 : o - 1, O = n ? 1 : -1, E = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
50
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s = c) : (s = Math.floor(Math.log(e) / Math.LN2), e * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + h >= 1 ? e += d / a : e += d * Math.pow(2, 1 - h), e * a >= 2 && (s++, a /= 2), s + h >= c ? (f = 0, s = c) : s + h >= 1 ? (f = (e * a - 1) * Math.pow(2, i), s = s + h) : (f = e * Math.pow(2, h - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + g] = f & 255, g += O, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
52
|
for (s = s << i | f, u += i; u > 0; t[r + g] = s & 255, g += O, s /= 256, u -= 8)
|
|
53
53
|
;
|
|
@@ -361,8 +361,8 @@ function Xe(t, e, r, n, i) {
|
|
|
361
361
|
c !== -1 && (u -= u - c), c = -1;
|
|
362
362
|
} else
|
|
363
363
|
for (r + f > s && (r = s - f), u = r; u >= 0; u--) {
|
|
364
|
-
for (var h = !0,
|
|
365
|
-
if (a(t, u +
|
|
364
|
+
for (var h = !0, d = 0; d < f; d++)
|
|
365
|
+
if (a(t, u + d) !== a(e, d)) {
|
|
366
366
|
h = !1;
|
|
367
367
|
break;
|
|
368
368
|
}
|
|
@@ -1316,10 +1316,10 @@ function ye(t, e, r) {
|
|
|
1316
1316
|
if (r < 0)
|
|
1317
1317
|
return Le(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special");
|
|
1318
1318
|
t.seen.push(e);
|
|
1319
|
-
var
|
|
1320
|
-
return u ?
|
|
1319
|
+
var d;
|
|
1320
|
+
return u ? d = Vr(t, e, r, s, o) : d = o.map(function(g) {
|
|
1321
1321
|
return Pe(t, e, r, s, g, u);
|
|
1322
|
-
}), t.seen.pop(), Jr(
|
|
1322
|
+
}), t.seen.pop(), Jr(d, a, c);
|
|
1323
1323
|
}
|
|
1324
1324
|
function zr(t, e) {
|
|
1325
1325
|
if (Q(e))
|
|
@@ -1698,11 +1698,11 @@ I.prototype.pipe = function(t, e) {
|
|
|
1698
1698
|
t.on("drain", a);
|
|
1699
1699
|
var u = !1;
|
|
1700
1700
|
function c() {
|
|
1701
|
-
b("cleanup"), t.removeListener("close", O), t.removeListener("finish", E), t.removeListener("drain", a), t.removeListener("error", g), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", c), r.removeListener("data",
|
|
1701
|
+
b("cleanup"), t.removeListener("close", O), t.removeListener("finish", E), t.removeListener("drain", a), t.removeListener("error", g), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", c), r.removeListener("data", d), u = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && a();
|
|
1702
1702
|
}
|
|
1703
1703
|
var h = !1;
|
|
1704
|
-
r.on("data",
|
|
1705
|
-
function
|
|
1704
|
+
r.on("data", d);
|
|
1705
|
+
function d(S) {
|
|
1706
1706
|
b("ondata"), h = !1;
|
|
1707
1707
|
var y = t.write(S);
|
|
1708
1708
|
y === !1 && !h && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && $t(n.pipes, t) !== -1) && !u && (b("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, h = !0), r.pause());
|
|
@@ -2665,7 +2665,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2665
2665
|
state: kn(r),
|
|
2666
2666
|
__needMoreData: function(n, i, o) {
|
|
2667
2667
|
if (o) return !1;
|
|
2668
|
-
const { encoding: s, escape: f, quote: a } = this.options, { quoting: u, needMoreDataSize: c, recordDelimiterMaxLength: h } = this.state,
|
|
2668
|
+
const { encoding: s, escape: f, quote: a } = this.options, { quoting: u, needMoreDataSize: c, recordDelimiterMaxLength: h } = this.state, d = i - n - 1, g = Math.max(
|
|
2669
2669
|
c,
|
|
2670
2670
|
// Skip if the remaining buffer smaller than record delimiter
|
|
2671
2671
|
// If "record_delimiter" is yet to be discovered:
|
|
@@ -2680,7 +2680,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2680
2680
|
// Skip if remaining buffer can be record delimiter following the closing quote
|
|
2681
2681
|
u ? a.length + h : 0
|
|
2682
2682
|
);
|
|
2683
|
-
return
|
|
2683
|
+
return d < g;
|
|
2684
2684
|
},
|
|
2685
2685
|
// Central parser implementation
|
|
2686
2686
|
parse: function(n, i, o, s) {
|
|
@@ -2690,7 +2690,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2690
2690
|
encoding: u,
|
|
2691
2691
|
from_line: c,
|
|
2692
2692
|
ltrim: h,
|
|
2693
|
-
max_record_size:
|
|
2693
|
+
max_record_size: d,
|
|
2694
2694
|
raw: g,
|
|
2695
2695
|
relax_quotes: O,
|
|
2696
2696
|
rtrim: E,
|
|
@@ -2733,41 +2733,41 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2733
2733
|
this.state.bomSkipped = !0;
|
|
2734
2734
|
}
|
|
2735
2735
|
const Ie = v.length;
|
|
2736
|
-
let
|
|
2737
|
-
for (
|
|
2736
|
+
let p;
|
|
2737
|
+
for (p = 0; p < Ie && !this.__needMoreData(p, Ie, i); p++) {
|
|
2738
2738
|
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), y !== -1 && this.info.lines > y) {
|
|
2739
2739
|
this.state.stop = !0, s();
|
|
2740
2740
|
return;
|
|
2741
2741
|
}
|
|
2742
2742
|
this.state.quoting === !1 && Re.length === 0 && this.__autoDiscoverRecordDelimiter(
|
|
2743
2743
|
v,
|
|
2744
|
-
|
|
2744
|
+
p
|
|
2745
2745
|
) && (Re = this.options.record_delimiter);
|
|
2746
|
-
const C = v[
|
|
2746
|
+
const C = v[p];
|
|
2747
2747
|
if (g === !0 && Qt.append(C), (C === $n || C === jn) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2748
2748
|
this.state.escaping = !1;
|
|
2749
2749
|
else {
|
|
2750
|
-
if (R !== null && this.state.quoting === !0 && this.__isEscape(v,
|
|
2750
|
+
if (R !== null && this.state.quoting === !0 && this.__isEscape(v, p, C) && p + R.length < Ie)
|
|
2751
2751
|
if (Ht) {
|
|
2752
|
-
if (this.__isQuote(v,
|
|
2753
|
-
this.state.escaping = !0,
|
|
2752
|
+
if (this.__isQuote(v, p + R.length)) {
|
|
2753
|
+
this.state.escaping = !0, p += R.length - 1;
|
|
2754
2754
|
continue;
|
|
2755
2755
|
}
|
|
2756
2756
|
} else {
|
|
2757
|
-
this.state.escaping = !0,
|
|
2757
|
+
this.state.escaping = !0, p += R.length - 1;
|
|
2758
2758
|
continue;
|
|
2759
2759
|
}
|
|
2760
|
-
if (this.state.commenting === !1 && this.__isQuote(v,
|
|
2760
|
+
if (this.state.commenting === !1 && this.__isQuote(v, p))
|
|
2761
2761
|
if (this.state.quoting === !0) {
|
|
2762
|
-
const A = v[
|
|
2762
|
+
const A = v[p + U.length], Z = E && this.__isCharTrimable(v, p + U.length), j = _ !== null && this.__compareBytes(_, v, p + U.length, A), X = this.__isDelimiter(
|
|
2763
2763
|
v,
|
|
2764
|
-
|
|
2764
|
+
p + U.length,
|
|
2765
2765
|
A
|
|
2766
|
-
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(v,
|
|
2767
|
-
if (R !== null && this.__isEscape(v,
|
|
2768
|
-
|
|
2766
|
+
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(v, p + U.length) : this.__isRecordDelimiter(A, v, p + U.length);
|
|
2767
|
+
if (R !== null && this.__isEscape(v, p, C) && this.__isQuote(v, p + R.length))
|
|
2768
|
+
p += R.length - 1;
|
|
2769
2769
|
else if (!A || X || de || j || Z) {
|
|
2770
|
-
this.state.quoting = !1, this.state.wasQuoting = !0,
|
|
2770
|
+
this.state.quoting = !1, this.state.wasQuoting = !0, p += U.length - 1;
|
|
2771
2771
|
continue;
|
|
2772
2772
|
} else if (O === !1) {
|
|
2773
2773
|
const Ge = this.__error(
|
|
@@ -2786,7 +2786,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2786
2786
|
);
|
|
2787
2787
|
if (Ge !== void 0) return Ge;
|
|
2788
2788
|
} else
|
|
2789
|
-
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(U),
|
|
2789
|
+
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(U), p += U.length - 1;
|
|
2790
2790
|
} else if (this.state.field.length !== 0) {
|
|
2791
2791
|
if (O === !1) {
|
|
2792
2792
|
const A = this.__infoField(), Z = Object.keys(re).map(
|
|
@@ -2809,31 +2809,31 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2809
2809
|
if (j !== void 0) return j;
|
|
2810
2810
|
}
|
|
2811
2811
|
} else {
|
|
2812
|
-
this.state.quoting = !0,
|
|
2812
|
+
this.state.quoting = !0, p += U.length - 1;
|
|
2813
2813
|
continue;
|
|
2814
2814
|
}
|
|
2815
2815
|
if (this.state.quoting === !1) {
|
|
2816
2816
|
const A = this.__isRecordDelimiter(
|
|
2817
2817
|
C,
|
|
2818
2818
|
v,
|
|
2819
|
-
|
|
2819
|
+
p
|
|
2820
2820
|
);
|
|
2821
2821
|
if (A !== 0) {
|
|
2822
2822
|
if (this.state.commenting && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0)
|
|
2823
2823
|
this.info.comment_lines++;
|
|
2824
2824
|
else {
|
|
2825
2825
|
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= c) {
|
|
2826
|
-
this.state.enabled = !0, this.__resetField(), this.__resetRecord(),
|
|
2826
|
+
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), p += A - 1;
|
|
2827
2827
|
continue;
|
|
2828
2828
|
}
|
|
2829
2829
|
if (x === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
|
|
2830
|
-
this.info.empty_lines++,
|
|
2830
|
+
this.info.empty_lines++, p += A - 1;
|
|
2831
2831
|
continue;
|
|
2832
2832
|
}
|
|
2833
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2833
|
+
this.info.bytes = this.state.bufBytesStart + p;
|
|
2834
2834
|
const X = this.__onField();
|
|
2835
2835
|
if (X !== void 0) return X;
|
|
2836
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2836
|
+
this.info.bytes = this.state.bufBytesStart + p + A;
|
|
2837
2837
|
const de = this.__onRecord(o);
|
|
2838
2838
|
if (de !== void 0) return de;
|
|
2839
2839
|
if (S !== -1 && this.info.records >= S) {
|
|
@@ -2841,44 +2841,44 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2841
2841
|
return;
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
|
-
this.state.commenting = !1,
|
|
2844
|
+
this.state.commenting = !1, p += A - 1;
|
|
2845
2845
|
continue;
|
|
2846
2846
|
}
|
|
2847
2847
|
if (this.state.commenting)
|
|
2848
2848
|
continue;
|
|
2849
|
-
if (_ !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(_, v,
|
|
2849
|
+
if (_ !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(_, v, p, C) !== 0) {
|
|
2850
2850
|
this.state.commenting = !0;
|
|
2851
2851
|
continue;
|
|
2852
2852
|
}
|
|
2853
|
-
const Z = this.__isDelimiter(v,
|
|
2853
|
+
const Z = this.__isDelimiter(v, p, C);
|
|
2854
2854
|
if (Z !== 0) {
|
|
2855
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2855
|
+
this.info.bytes = this.state.bufBytesStart + p;
|
|
2856
2856
|
const j = this.__onField();
|
|
2857
2857
|
if (j !== void 0) return j;
|
|
2858
|
-
|
|
2858
|
+
p += Z - 1;
|
|
2859
2859
|
continue;
|
|
2860
2860
|
}
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
if (this.state.commenting === !1 &&
|
|
2863
|
+
if (this.state.commenting === !1 && d !== 0 && this.state.record_length + this.state.field.length > d)
|
|
2864
2864
|
return this.__error(
|
|
2865
2865
|
new w(
|
|
2866
2866
|
"CSV_MAX_RECORD_SIZE",
|
|
2867
2867
|
[
|
|
2868
2868
|
"Max Record Size:",
|
|
2869
2869
|
"record exceed the maximum number of tolerated bytes",
|
|
2870
|
-
`of ${
|
|
2870
|
+
`of ${d}`,
|
|
2871
2871
|
`at line ${this.info.lines}`
|
|
2872
2872
|
],
|
|
2873
2873
|
this.options,
|
|
2874
2874
|
this.__infoField()
|
|
2875
2875
|
)
|
|
2876
2876
|
);
|
|
2877
|
-
const J = h === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(v,
|
|
2877
|
+
const J = h === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(v, p), he = E === !1 || this.state.wasQuoting === !1;
|
|
2878
2878
|
if (J === !0 && he === !0)
|
|
2879
2879
|
this.state.field.append(C);
|
|
2880
2880
|
else {
|
|
2881
|
-
if (E === !0 && !this.__isCharTrimable(v,
|
|
2881
|
+
if (E === !0 && !this.__isCharTrimable(v, p))
|
|
2882
2882
|
return this.__error(
|
|
2883
2883
|
new w(
|
|
2884
2884
|
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
@@ -2891,7 +2891,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2891
2891
|
this.__infoField()
|
|
2892
2892
|
)
|
|
2893
2893
|
);
|
|
2894
|
-
J === !1 && (
|
|
2894
|
+
J === !1 && (p += this.__isCharTrimable(v, p) - 1);
|
|
2895
2895
|
continue;
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
@@ -2910,14 +2910,14 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2910
2910
|
);
|
|
2911
2911
|
if (C !== void 0) return C;
|
|
2912
2912
|
} else if (this.state.wasQuoting === !0 || this.state.record.length !== 0 || this.state.field.length !== 0) {
|
|
2913
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2913
|
+
this.info.bytes = this.state.bufBytesStart + p;
|
|
2914
2914
|
const C = this.__onField();
|
|
2915
2915
|
if (C !== void 0) return C;
|
|
2916
2916
|
const J = this.__onRecord(o);
|
|
2917
2917
|
if (J !== void 0) return J;
|
|
2918
2918
|
} else this.state.wasRowDelimiter === !0 ? this.info.empty_lines++ : this.state.commenting === !0 && this.info.comment_lines++;
|
|
2919
2919
|
else
|
|
2920
|
-
this.state.bufBytesStart +=
|
|
2920
|
+
this.state.bufBytesStart += p, this.state.previousBuf = v.slice(p);
|
|
2921
2921
|
this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1);
|
|
2922
2922
|
},
|
|
2923
2923
|
__onRecord: function(n) {
|
|
@@ -2930,7 +2930,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2930
2930
|
relax_column_count: u,
|
|
2931
2931
|
relax_column_count_less: c,
|
|
2932
2932
|
relax_column_count_more: h,
|
|
2933
|
-
raw:
|
|
2933
|
+
raw: d,
|
|
2934
2934
|
skip_records_with_empty_values: g
|
|
2935
2935
|
} = this.options, { enabled: O, record: E } = this.state;
|
|
2936
2936
|
if (O === !1)
|
|
@@ -2991,10 +2991,10 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2991
2991
|
const y = {};
|
|
2992
2992
|
for (let _ = 0, R = E.length; _ < R; _++)
|
|
2993
2993
|
i[_] === void 0 || i[_].disabled || (o === !0 && y[i[_].name] !== void 0 ? Array.isArray(y[i[_].name]) ? y[i[_].name] = y[i[_].name].concat(E[_]) : y[i[_].name] = [y[i[_].name], E[_]] : y[i[_].name] = E[_]);
|
|
2994
|
-
if (
|
|
2994
|
+
if (d === !0 || f === !0) {
|
|
2995
2995
|
const _ = Object.assign(
|
|
2996
2996
|
{ record: y },
|
|
2997
|
-
|
|
2997
|
+
d === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
2998
2998
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
2999
2999
|
), R = this.__push(
|
|
3000
3000
|
S === void 0 ? _ : [y[S], _],
|
|
@@ -3010,10 +3010,10 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3010
3010
|
if (_)
|
|
3011
3011
|
return _;
|
|
3012
3012
|
}
|
|
3013
|
-
} else if (
|
|
3013
|
+
} else if (d === !0 || f === !0) {
|
|
3014
3014
|
const y = Object.assign(
|
|
3015
3015
|
{ record: E },
|
|
3016
|
-
|
|
3016
|
+
d === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
3017
3017
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
3018
3018
|
), _ = this.__push(
|
|
3019
3019
|
S === void 0 ? y : [E[S], y],
|
|
@@ -3391,8 +3391,8 @@ class ri {
|
|
|
3391
3391
|
async determineSchemaConfig(e, r) {
|
|
3392
3392
|
const n = Xn(e), i = await Kn(e);
|
|
3393
3393
|
return {
|
|
3394
|
-
|
|
3395
|
-
|
|
3394
|
+
recordDelimiterId: n,
|
|
3395
|
+
valueDelimiterId: i
|
|
3396
3396
|
};
|
|
3397
3397
|
}
|
|
3398
3398
|
/**
|
|
@@ -3400,10 +3400,10 @@ class ri {
|
|
|
3400
3400
|
*/
|
|
3401
3401
|
async parseStream(e, r, n, i, o) {
|
|
3402
3402
|
return new Promise((s, f) => {
|
|
3403
|
-
let a, u, c, h = !1,
|
|
3403
|
+
let a, u, c, h = !1, d = !1;
|
|
3404
3404
|
const g = () => {
|
|
3405
|
-
if (
|
|
3406
|
-
|
|
3405
|
+
if (d) return;
|
|
3406
|
+
d = !0;
|
|
3407
3407
|
const x = a;
|
|
3408
3408
|
a = void 0, c = void 0, x != null && (Be(() => x.removeAllListeners()), Be(() => x.end())), Be(() => {
|
|
3409
3409
|
u?.cancel();
|
|
@@ -3464,21 +3464,22 @@ async function Kn(t) {
|
|
|
3464
3464
|
await new Promise((h) => {
|
|
3465
3465
|
try {
|
|
3466
3466
|
c.on("readable", () => {
|
|
3467
|
-
let
|
|
3468
|
-
for (; (
|
|
3467
|
+
let d;
|
|
3468
|
+
for (; (d = c.read()) != null; ) {
|
|
3469
3469
|
a++;
|
|
3470
|
-
const g =
|
|
3470
|
+
const g = d.length;
|
|
3471
3471
|
f != null && (u += Math.abs(g - f)), f = g, s += g;
|
|
3472
3472
|
}
|
|
3473
3473
|
}), c.on("error", () => h()), c.on("end", () => {
|
|
3474
|
-
const
|
|
3475
|
-
console.log(1111, r, n, i,
|
|
3474
|
+
const d = s / a;
|
|
3475
|
+
console.log(1111, r, n, i, d), (!i || u <= i) && (!n || d > n) && (r = o, n = d, i = u), console.log(2222, r, n, i), h();
|
|
3476
3476
|
}), c.write(t), c.end();
|
|
3477
|
-
} catch {
|
|
3478
|
-
h();
|
|
3477
|
+
} catch (d) {
|
|
3478
|
+
console.log(8888, d), h();
|
|
3479
3479
|
}
|
|
3480
3480
|
});
|
|
3481
|
-
} catch {
|
|
3481
|
+
} catch (s) {
|
|
3482
|
+
console.log(8888, s);
|
|
3482
3483
|
}
|
|
3483
3484
|
return console.log(333, r), r ?? ",";
|
|
3484
3485
|
}
|