spliterator 1.5.1 → 1.6.0
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/README.md +18 -2
- package/out/index.d.ts +0 -2
- package/out/index.d.ts.map +1 -1
- package/out/index.js +0 -2
- package/out/index.js.map +1 -1
- package/out/lib/AsyncSpliterator.d.ts +92 -11
- package/out/lib/AsyncSpliterator.d.ts.map +1 -1
- package/out/lib/AsyncSpliterator.js +153 -81
- package/out/lib/AsyncSpliterator.js.map +1 -1
- package/out/lib/BufferController.d.ts +12 -0
- package/out/lib/BufferController.d.ts.map +1 -1
- package/out/lib/BufferController.js +22 -0
- package/out/lib/BufferController.js.map +1 -1
- package/out/lib/CSVSpliterator.d.ts +30 -24
- package/out/lib/CSVSpliterator.d.ts.map +1 -1
- package/out/lib/CSVSpliterator.js +83 -33
- package/out/lib/CSVSpliterator.js.map +1 -1
- package/out/lib/CharacterSequence.d.ts +5 -15
- package/out/lib/CharacterSequence.d.ts.map +1 -1
- package/out/lib/CharacterSequence.js +15 -49
- package/out/lib/CharacterSequence.js.map +1 -1
- package/out/lib/JSONSpliterator.js +1 -1
- package/out/lib/JSONSpliterator.js.map +1 -1
- package/out/lib/SlidingWindow.d.ts +1 -47
- package/out/lib/SlidingWindow.d.ts.map +1 -1
- package/out/lib/SlidingWindow.js +0 -114
- package/out/lib/SlidingWindow.js.map +1 -1
- package/out/lib/Spliterator.d.ts +55 -5
- package/out/lib/Spliterator.d.ts.map +1 -1
- package/out/lib/Spliterator.js +138 -41
- package/out/lib/Spliterator.js.map +1 -1
- package/out/lib/shared.d.ts +21 -9
- package/out/lib/shared.d.ts.map +1 -1
- package/out/lib/shared.js +6 -6
- package/out/lib/shared.js.map +1 -1
- package/out/node/cli/commands/csv.d.ts +44 -0
- package/out/node/cli/commands/csv.d.ts.map +1 -0
- package/out/node/cli/commands/csv.js +78 -0
- package/out/node/cli/commands/csv.js.map +1 -0
- package/out/node/cli/commands/iterate.d.ts +37 -0
- package/out/node/cli/commands/iterate.d.ts.map +1 -0
- package/out/node/cli/commands/iterate.js +54 -0
- package/out/node/cli/commands/iterate.js.map +1 -0
- package/out/node/cli/index.d.ts +9 -0
- package/out/node/cli/index.d.ts.map +1 -0
- package/out/node/cli/index.js +34 -0
- package/out/node/cli/index.js.map +1 -0
- package/out/node/cli/utils.d.ts +52 -0
- package/out/node/cli/utils.d.ts.map +1 -0
- package/out/node/cli/utils.js +70 -0
- package/out/node/cli/utils.js.map +1 -0
- package/out/node/fs/index.d.ts +58 -0
- package/out/node/fs/index.d.ts.map +1 -0
- package/out/node/fs/index.js +142 -0
- package/out/node/fs/index.js.map +1 -0
- package/package.json +9 -4
- package/out/lib/DelimitedChunkReader.d.ts +0 -67
- package/out/lib/DelimitedChunkReader.d.ts.map +0 -1
- package/out/lib/DelimitedChunkReader.js +0 -113
- package/out/lib/DelimitedChunkReader.js.map +0 -1
- package/out/lib/DelimiterTransformer.d.ts +0 -27
- package/out/lib/DelimiterTransformer.d.ts.map +0 -1
- package/out/lib/DelimiterTransformer.js +0 -26
- package/out/lib/DelimiterTransformer.js.map +0 -1
- package/out/lib/node/fs.d.ts +0 -98
- package/out/lib/node/fs.d.ts.map +0 -1
- package/out/lib/node/fs.js +0 -162
- package/out/lib/node/fs.js.map +0 -1
package/out/lib/SlidingWindow.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
6
|
import { CharacterSequence } from "./CharacterSequence.js";
|
|
7
|
-
import { applyReaderPolyfill } from "./shared.js";
|
|
8
7
|
/**
|
|
9
8
|
* A sliding window that iterates over an in-memory buffer, yielding byte ranges.
|
|
10
9
|
*
|
|
@@ -60,117 +59,4 @@ export class SlidingWindow {
|
|
|
60
59
|
return this;
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
/**
|
|
64
|
-
* An asynchronous sliding window that iterates over a file handle, yielding byte ranges.
|
|
65
|
-
*
|
|
66
|
-
* @see {@link SlidingWindow} for a synchronous version.
|
|
67
|
-
*/
|
|
68
|
-
export class AsyncSlidingWindow {
|
|
69
|
-
#file;
|
|
70
|
-
#delimiter;
|
|
71
|
-
#byteLength;
|
|
72
|
-
#done = false;
|
|
73
|
-
#autoClose;
|
|
74
|
-
/**
|
|
75
|
-
* The current byte index of the sliding window.
|
|
76
|
-
*/
|
|
77
|
-
cursor;
|
|
78
|
-
/**
|
|
79
|
-
* Given a byte array containing delimited data, yield a sliding window of indexes.
|
|
80
|
-
*
|
|
81
|
-
* This a low-level utility function that can be used to implement more complex parsing logic.
|
|
82
|
-
*/
|
|
83
|
-
constructor(file, init) {
|
|
84
|
-
applyReaderPolyfill(file);
|
|
85
|
-
this.#file = file;
|
|
86
|
-
this.#byteLength = init.byteLength ?? Infinity;
|
|
87
|
-
this.#delimiter = new CharacterSequence(init.delimiter);
|
|
88
|
-
this.cursor = init.position ?? 0;
|
|
89
|
-
this.#autoClose = init.autoClose ?? false;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Read the next byte range from the file handle.
|
|
93
|
-
*/
|
|
94
|
-
async next() {
|
|
95
|
-
const lookahead = this.#delimiter.length;
|
|
96
|
-
for (let end = this.cursor; end < this.#byteLength; end++) {
|
|
97
|
-
const byteSlice = await this.#file.read({
|
|
98
|
-
position: end,
|
|
99
|
-
// lenegth: end + lookahead
|
|
100
|
-
});
|
|
101
|
-
const match = byteSlice.every((byte, i) => byte === this.#delimiter[i]);
|
|
102
|
-
if (!match)
|
|
103
|
-
continue;
|
|
104
|
-
const range = [this.cursor, end];
|
|
105
|
-
this.cursor = end + lookahead;
|
|
106
|
-
return { value: range, done: false };
|
|
107
|
-
}
|
|
108
|
-
// Handle the final window if we haven't reached the byte limit
|
|
109
|
-
// and there's remaining content after the last delimiter
|
|
110
|
-
if (this.cursor <= this.#byteLength && !this.#done) {
|
|
111
|
-
const range = [this.cursor, this.#byteLength];
|
|
112
|
-
this.cursor = this.#byteLength;
|
|
113
|
-
this.#done = true;
|
|
114
|
-
return { value: range, done: false };
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
value: undefined,
|
|
118
|
-
done: true,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Read the previous byte range from the file handle.
|
|
123
|
-
*
|
|
124
|
-
* This is useful for backtracking in the event that a delimiter is split across two windows.
|
|
125
|
-
*/
|
|
126
|
-
async previous() {
|
|
127
|
-
const lookahead = this.#delimiter.length;
|
|
128
|
-
for (let start = this.cursor; start > 0; start--) {
|
|
129
|
-
const byteSlice = await this.#file.read({ position: start - lookahead, length: start });
|
|
130
|
-
const match = byteSlice.every((byte, i) => byte === this.#delimiter[i]);
|
|
131
|
-
if (!match)
|
|
132
|
-
continue;
|
|
133
|
-
const range = [start - lookahead, this.cursor];
|
|
134
|
-
this.cursor = start - lookahead;
|
|
135
|
-
return { value: range, done: false };
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
value: undefined,
|
|
139
|
-
done: true,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Given a collection of sliding windows, iterate over them and coalesce adjacent windows.
|
|
144
|
-
*
|
|
145
|
-
* @yields Each coalesced window.
|
|
146
|
-
*/
|
|
147
|
-
static async *collect(slidingWindows) {
|
|
148
|
-
let results;
|
|
149
|
-
let done;
|
|
150
|
-
do {
|
|
151
|
-
results = await Promise.all(slidingWindows.map((window) => {
|
|
152
|
-
return window.next();
|
|
153
|
-
}));
|
|
154
|
-
const emitted = [];
|
|
155
|
-
for (const result of results) {
|
|
156
|
-
done = result.done;
|
|
157
|
-
if (result.done)
|
|
158
|
-
continue;
|
|
159
|
-
emitted.push(result.value);
|
|
160
|
-
}
|
|
161
|
-
yield emitted;
|
|
162
|
-
} while (!done);
|
|
163
|
-
}
|
|
164
|
-
async [Symbol.asyncDispose]() {
|
|
165
|
-
if (this.#autoClose) {
|
|
166
|
-
await this.#file[Symbol.asyncDispose]?.();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
dispose() {
|
|
170
|
-
return this[Symbol.asyncDispose]();
|
|
171
|
-
}
|
|
172
|
-
[Symbol.asyncIterator]() {
|
|
173
|
-
return this;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
62
|
//# sourceMappingURL=SlidingWindow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlidingWindow.js","sourceRoot":"","sources":["../../lib/SlidingWindow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAA0B,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"SlidingWindow.js","sourceRoot":"","sources":["../../lib/SlidingWindow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAA0B,MAAM,wBAAwB,CAAA;AAoBlF;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACzB,MAAM,CAAG;IACT,UAAU,CAAmB;IAC7B,WAAW,CAAQ;IACnB,KAAK,GAAG,KAAK,CAAA;IAEb;;OAEG;IACH,MAAM,CAAQ;IAEd;;;;OAIG;IACH;IACC;;OAEG;IACH,MAAS,EACT,OAA0B,EAAE;QAE5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;IACrF,CAAC;IAEM,IAAI;QACV,KAAK,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC;YAC3D,wDAAwD;YACxD,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;YAE/E,0CAA0C;YAC1C,IAAI,CAAC,KAAK;gBAAE,SAAQ;YAEpB,MAAM,KAAK,GAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;YAE3C,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAA;YAE1C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QACrC,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACpD,MAAM,KAAK,GAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;YAExD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAA;YAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;YAEjB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QACrC,CAAC;QAED,OAAO;YACN,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,IAAI;SACV,CAAA;IACF,CAAC;IAEM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAA;IACZ,CAAC;CACD"}
|
package/out/lib/Spliterator.d.ts
CHANGED
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { AsyncSpliterator, AsyncSpliteratorInit, SpliteratorInit } from "./AsyncSpliterator.js";
|
|
7
7
|
import { CharacterSequenceInput } from "./CharacterSequence.js";
|
|
8
|
+
import { AsyncChunkIterator, AsyncDataResource } from "./shared.js";
|
|
8
9
|
export { AsyncSpliterator };
|
|
9
10
|
export type { AsyncSpliteratorInit, SpliteratorInit };
|
|
10
11
|
/**
|
|
11
12
|
* A byte stream delimiting iterator.
|
|
12
13
|
*/
|
|
13
|
-
export declare class Spliterator implements IterableIterator<
|
|
14
|
+
export declare class Spliterator<R extends DataView | ArrayBuffer = Uint8Array> implements IterableIterator<R>, Disposable {
|
|
14
15
|
#private;
|
|
15
16
|
/**
|
|
16
17
|
* Create a spliterator from an asynchronous resource such as a file.
|
|
@@ -28,7 +29,53 @@ export declare class Spliterator implements IterableIterator<Uint8Array>, Dispos
|
|
|
28
29
|
* @param source - The data resource to read from.
|
|
29
30
|
* @param init - The initialization options for the generator.
|
|
30
31
|
*/
|
|
31
|
-
static
|
|
32
|
+
static fromSync<T extends CharacterSequenceInput>(source: T, init?: SpliteratorInit): Spliterator;
|
|
33
|
+
/**
|
|
34
|
+
* Create a spliterator from an iterable resource such as a buffer, array, or string.
|
|
35
|
+
*
|
|
36
|
+
* @param source - The data resource to read from.
|
|
37
|
+
* @param init - The initialization options for the generator.
|
|
38
|
+
*/
|
|
39
|
+
static from(source: CharacterSequenceInput, init?: SpliteratorInit): Spliterator;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new delimited generator from an asynchronous byte stream.
|
|
42
|
+
*
|
|
43
|
+
* @param source - The data resource to read from.
|
|
44
|
+
* @param init - The initialization options for the generator.
|
|
45
|
+
*
|
|
46
|
+
* @returns A new generator instance, yielding byte ranges.
|
|
47
|
+
*/
|
|
48
|
+
static from(source: AsyncChunkIterator, init?: AsyncSpliteratorInit): AsyncSpliterator;
|
|
49
|
+
/**
|
|
50
|
+
* Create a new delimited generator from a resource such as a file handle or URL.
|
|
51
|
+
*
|
|
52
|
+
* @param source - The data resource to read from.
|
|
53
|
+
* @param init - The initialization options for the generator.
|
|
54
|
+
*
|
|
55
|
+
* @returns A new generator instance, yielding byte ranges.
|
|
56
|
+
*/
|
|
57
|
+
static from(source: AsyncDataResource, init?: AsyncSpliteratorInit): Promise<AsyncSpliterator>;
|
|
58
|
+
/**
|
|
59
|
+
* Create a new delimited generator from a resource such as a file handle, URL, or byte stream.
|
|
60
|
+
*
|
|
61
|
+
* @param source - The data resource to read from.
|
|
62
|
+
* @param init - The initialization options for the generator.
|
|
63
|
+
*
|
|
64
|
+
* @returns A new generator instance, yielding byte ranges.
|
|
65
|
+
*/
|
|
66
|
+
/**
|
|
67
|
+
* Create a new delimited generator from a resource such as a file handle, URL, or byte stream.
|
|
68
|
+
*
|
|
69
|
+
* @param source - The data resource to read from.
|
|
70
|
+
* @param init - The initialization options for the generator.
|
|
71
|
+
*
|
|
72
|
+
* @returns A new generator instance, yielding byte ranges.
|
|
73
|
+
*/
|
|
74
|
+
static from(source: CharacterSequenceInput | AsyncDataResource | AsyncChunkIterator, init?: SpliteratorInit & AsyncSpliteratorInit): Spliterator | AsyncSpliterator | Promise<AsyncSpliterator>;
|
|
75
|
+
/**
|
|
76
|
+
* Create a new delimited generator from a data resource.
|
|
77
|
+
*/
|
|
78
|
+
static toTransformStream(init: SpliteratorInit): TransformStream<Uint8Array, Uint8Array[]>;
|
|
32
79
|
/**
|
|
33
80
|
* Dispose of the spliterator, closing the file handle if necessary.
|
|
34
81
|
*/
|
|
@@ -37,15 +84,18 @@ export declare class Spliterator implements IterableIterator<Uint8Array>, Dispos
|
|
|
37
84
|
/**
|
|
38
85
|
* Read the next byte range from the source.
|
|
39
86
|
*/
|
|
40
|
-
next(): IteratorResult<
|
|
87
|
+
next(): IteratorResult<R>;
|
|
41
88
|
/**
|
|
42
89
|
* Collect all the byte ranges from the file.
|
|
90
|
+
*
|
|
91
|
+
* @returns An array of encoded byte ranges.
|
|
92
|
+
* @see {@linkcode toDecodedArray} to automatically decode the byte ranges.
|
|
43
93
|
*/
|
|
44
|
-
toArray():
|
|
94
|
+
toArray(): R[];
|
|
45
95
|
/**
|
|
46
96
|
* Collect all the byte ranges from the file as a string.
|
|
47
97
|
*/
|
|
48
98
|
toDecodedArray(decoder?: import("util").TextDecoder): string[];
|
|
49
|
-
[Symbol.iterator](): IterableIterator<
|
|
99
|
+
[Symbol.iterator](): IterableIterator<R>;
|
|
50
100
|
}
|
|
51
101
|
//# sourceMappingURL=Spliterator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spliterator.d.ts","sourceRoot":"","sources":["../../lib/Spliterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC/F,OAAO,
|
|
1
|
+
{"version":3,"file":"Spliterator.d.ts","sourceRoot":"","sources":["../../lib/Spliterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC/F,OAAO,EAEN,sBAAsB,EAGtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAoC,MAAM,aAAa,CAAA;AAErG,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAE3B,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAA;AAErD;;GAEG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAE,YAAW,gBAAgB,CAAC,CAAC,CAAC,EAAE,UAAU;;IAGjH;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,+BAAwB;IAExC;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,sBAAsB,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,GAAE,eAAoB,GAAG,WAAW;IAIrG;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,WAAW;IAChF;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,oBAAoB,GAAG,gBAAgB;IACtF;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAC9F;;;;;;;OAOG;IACH;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CACV,MAAM,EAAE,sBAAsB,GAAG,iBAAiB,GAAG,kBAAkB,EACvE,IAAI,CAAC,EAAE,eAAe,GAAG,oBAAoB,GAC3C,WAAW,GAAG,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAsB7D;;OAEG;WACW,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC;IAUjG;;OAEG;IACI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;gBAInB,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,eAAoB;IA+R1D;;OAEG;IACI,IAAI,IAAI,cAAc,CAAC,CAAC,CAAC;IAuChC;;;;;OAKG;IACI,OAAO,IAAI,CAAC,EAAE;IAIrB;;OAEG;IACI,cAAc,CAAC,OAAO,6BAAoB,GAAG,MAAM,EAAE;IAIrD,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC;CAG/C"}
|
package/out/lib/Spliterator.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
6
|
import { AsyncSpliterator } from "./AsyncSpliterator.js";
|
|
7
|
-
import { CharacterSequence, normalizeCharacterInput } from "./CharacterSequence.js";
|
|
7
|
+
import { CharacterSequence, debugAsVisibleCharacters, normalizeCharacterInput, } from "./CharacterSequence.js";
|
|
8
8
|
import { IndexQueue } from "./IndexQueue.js";
|
|
9
|
+
import { isFileHandleLike } from "./shared.js";
|
|
9
10
|
export { AsyncSpliterator };
|
|
10
11
|
/**
|
|
11
12
|
* A byte stream delimiting iterator.
|
|
@@ -28,9 +29,34 @@ export class Spliterator {
|
|
|
28
29
|
* @param source - The data resource to read from.
|
|
29
30
|
* @param init - The initialization options for the generator.
|
|
30
31
|
*/
|
|
32
|
+
static fromSync(source, init = {}) {
|
|
33
|
+
return new Spliterator(normalizeCharacterInput(source), init);
|
|
34
|
+
}
|
|
31
35
|
static from(source, init = {}) {
|
|
36
|
+
if (typeof source === "object" && Symbol.asyncIterator in source) {
|
|
37
|
+
return new AsyncSpliterator(source, init);
|
|
38
|
+
}
|
|
39
|
+
if (typeof source === "string" || source instanceof URL || isFileHandleLike(source)) {
|
|
40
|
+
return import("spliterator/node/fs").then(async ({ createChunkIterator }) => {
|
|
41
|
+
const chunkIterator = await createChunkIterator(source, {
|
|
42
|
+
highWaterMark: init.highWaterMark,
|
|
43
|
+
});
|
|
44
|
+
return new AsyncSpliterator(chunkIterator, init);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
32
47
|
return new Spliterator(normalizeCharacterInput(source), init);
|
|
33
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a new delimited generator from a data resource.
|
|
51
|
+
*/
|
|
52
|
+
static toTransformStream(init) {
|
|
53
|
+
return new TransformStream({
|
|
54
|
+
transform(chunk, controller) {
|
|
55
|
+
const spliterator = new Spliterator(chunk, init);
|
|
56
|
+
controller.enqueue(spliterator.toArray());
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
34
60
|
/**
|
|
35
61
|
* Dispose of the spliterator, closing the file handle if necessary.
|
|
36
62
|
*/
|
|
@@ -68,6 +94,10 @@ export class Spliterator {
|
|
|
68
94
|
* The byte sequence to search for, i.e. an encoded delimiter.
|
|
69
95
|
*/
|
|
70
96
|
#needle;
|
|
97
|
+
/**
|
|
98
|
+
* The byte sequence for a double quote.
|
|
99
|
+
*/
|
|
100
|
+
#doubleQuoteSequence = new CharacterSequence('"');
|
|
71
101
|
/**
|
|
72
102
|
* How many yields to skip.
|
|
73
103
|
*/
|
|
@@ -105,9 +135,13 @@ export class Spliterator {
|
|
|
105
135
|
*/
|
|
106
136
|
#readPosition;
|
|
107
137
|
/**
|
|
108
|
-
*
|
|
138
|
+
* A bit of a hack to keep track of double quotes.
|
|
139
|
+
*/
|
|
140
|
+
#doubleQuoteStartIndex = -1;
|
|
141
|
+
/**
|
|
142
|
+
* The previous byte range seen while draining the buffer.
|
|
109
143
|
*/
|
|
110
|
-
#
|
|
144
|
+
#previousByteRange;
|
|
111
145
|
/**
|
|
112
146
|
* Whether to output debug information.
|
|
113
147
|
*/
|
|
@@ -142,53 +176,107 @@ export class Spliterator {
|
|
|
142
176
|
value: undefined,
|
|
143
177
|
};
|
|
144
178
|
}
|
|
179
|
+
#drain() {
|
|
180
|
+
const sourceByteLength = this.#source.byteLength;
|
|
181
|
+
this.#log("Reached end of file. Preparing to finalize.");
|
|
182
|
+
// There's a few special cases we could get this far and not have drained the buffer.
|
|
183
|
+
const lastByteRange = this.#previousByteRange;
|
|
184
|
+
if (lastByteRange) {
|
|
185
|
+
const lastByteIndex = lastByteRange[1];
|
|
186
|
+
// There's a special case where the last delimiter is at the end of the *file*.
|
|
187
|
+
// We need to determine if we're at the end of the *file* and there's no delimiter.
|
|
188
|
+
const possibleDelimiterIndex = this.#needle.search(this.#source, sourceByteLength - this.#needle.length);
|
|
189
|
+
if (possibleDelimiterIndex !== -1) {
|
|
190
|
+
this.#log("Inserted byte range at the last delimiter", [possibleDelimiterIndex, sourceByteLength]);
|
|
191
|
+
// We found a delimiter at the end of the file, so we enqueue the byte range.
|
|
192
|
+
this.#indices.enqueue([possibleDelimiterIndex + this.#needle.length, sourceByteLength]);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
this.#log("Inserted byte range at the last byte", [lastByteIndex, sourceByteLength]);
|
|
196
|
+
// The file didn't end with a delimiter, so we just enqueue the last byte range.
|
|
197
|
+
this.#indices.enqueue([lastByteIndex + this.#needle.length, sourceByteLength]);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else if (this.#yieldCount === 0) {
|
|
201
|
+
// We didn't find any delimiters in the file, so we just enqueue the whole buffer.
|
|
202
|
+
this.#indices.enqueue([0, sourceByteLength]);
|
|
203
|
+
}
|
|
204
|
+
this.#done = true;
|
|
205
|
+
}
|
|
145
206
|
/**
|
|
146
207
|
* Fill the buffer with data and search for delimiters.
|
|
147
208
|
*/
|
|
148
209
|
#fill() {
|
|
149
210
|
const sourceByteLength = this.#source.byteLength;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
211
|
+
while (this.#readPosition < sourceByteLength && this.#indices.byteLength < this.#highWaterMark) {
|
|
212
|
+
const doubleQuoteStartIndex = this.#doubleQuoteStartIndex;
|
|
213
|
+
let nextDoubleQuoteIndex;
|
|
214
|
+
let delimiterSearchStart = this.#readPosition;
|
|
215
|
+
let sliceEnd;
|
|
216
|
+
let sliceStart = this.#readPosition;
|
|
217
|
+
// if (doubleQuoteStartIndex !== -1) {
|
|
218
|
+
// nextDoubleQuoteIndex = this.#doubleQuoteSequence.search(this.#source, doubleQuoteStartIndex + 1)
|
|
219
|
+
// } else {
|
|
220
|
+
// nextDoubleQuoteIndex = this.#doubleQuoteSequence.search(this.#source, this.#readPosition)
|
|
221
|
+
// }
|
|
222
|
+
// if (nextDoubleQuoteIndex !== -1) {
|
|
223
|
+
// console.log("Next double quote at", nextDoubleQuoteIndex)
|
|
224
|
+
// delimiterSearchStart = nextDoubleQuoteIndex + 1
|
|
225
|
+
// } else {
|
|
226
|
+
// // console.log("No double quote found after previous double quote")
|
|
227
|
+
// delimiterSearchStart = this.#readPosition
|
|
228
|
+
// }
|
|
229
|
+
// this.#doubleQuoteStartIndex = -1
|
|
230
|
+
// } else {
|
|
231
|
+
// // console.log("Searching for double quote at read position", this.#readPosition)
|
|
232
|
+
// nextDoubleQuoteIndex = this.#doubleQuoteSequence.search(this.#source, this.#readPosition)
|
|
233
|
+
// if (nextDoubleQuoteIndex !== -1) {
|
|
234
|
+
// console.log("Found double quote at", nextDoubleQuoteIndex)
|
|
235
|
+
// this.#doubleQuoteStartIndex = nextDoubleQuoteIndex
|
|
236
|
+
// sliceStart = doubleQuoteStartIndex + 1
|
|
237
|
+
// delimiterSearchStart = nextDoubleQuoteIndex + 1
|
|
238
|
+
// } else {
|
|
239
|
+
// // console.log("No double quote found at read position")
|
|
240
|
+
// delimiterSearchStart = this.#readPosition
|
|
241
|
+
// }
|
|
242
|
+
// }
|
|
243
|
+
let delimiterIndex;
|
|
244
|
+
while (true) {
|
|
245
|
+
delimiterIndex = this.#needle.search(this.#source, delimiterSearchStart);
|
|
246
|
+
if (delimiterIndex === -1) {
|
|
247
|
+
// this.#log(`No delimiters left. Breaking.`)
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
nextDoubleQuoteIndex = this.#doubleQuoteSequence.search(this.#source, delimiterSearchStart, delimiterIndex);
|
|
251
|
+
// Didn't find a double quote before the delimiter.
|
|
252
|
+
if (nextDoubleQuoteIndex === -1 && this.#doubleQuoteStartIndex === -1) {
|
|
253
|
+
// And we haven't found a double quote before.
|
|
254
|
+
sliceEnd = delimiterIndex;
|
|
255
|
+
this.#readPosition = sliceEnd + this.#needle.length;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
if (nextDoubleQuoteIndex !== -1) {
|
|
259
|
+
// We found a double quote before the delimiter...
|
|
260
|
+
if (this.#doubleQuoteStartIndex === -1) {
|
|
261
|
+
// But this is the first double quote we've found.
|
|
262
|
+
this.#doubleQuoteStartIndex = nextDoubleQuoteIndex;
|
|
263
|
+
delimiterSearchStart = delimiterIndex + 1;
|
|
264
|
+
continue;
|
|
164
265
|
}
|
|
165
266
|
else {
|
|
166
|
-
this.#
|
|
167
|
-
// The file didn't end with a delimiter, so we just enqueue the last byte range.
|
|
168
|
-
this.#indices.enqueue([lastByteIndex + this.#needle.length, sourceByteLength]);
|
|
267
|
+
sliceStart = this.#doubleQuoteStartIndex + 1;
|
|
169
268
|
}
|
|
170
269
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
else if (this.#yieldCount === 0) {
|
|
176
|
-
// We didn't find any delimiters in the file, so we just enqueue the whole buffer.
|
|
177
|
-
this.#indices.enqueue([0, sourceByteLength]);
|
|
178
|
-
}
|
|
179
|
-
this.#done = true;
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
while (this.#readPosition < sourceByteLength && this.#indices.byteLength < this.#highWaterMark) {
|
|
183
|
-
// Unlike the async version, we can keep reading until our indices match the high water mark.
|
|
184
|
-
const delimiterIndex = this.#needle.search(this.#source, this.#readPosition);
|
|
185
|
-
if (delimiterIndex === -1) {
|
|
186
|
-
this.#log(`No viable byte range found in buffer. Breaking.`);
|
|
270
|
+
// We found a double quote before the delimiter, but it's not the first one.
|
|
271
|
+
sliceEnd = delimiterIndex - 1;
|
|
272
|
+
this.#readPosition = delimiterIndex + this.#needle.length;
|
|
273
|
+
this.#doubleQuoteStartIndex = -1;
|
|
187
274
|
break;
|
|
188
275
|
}
|
|
189
|
-
|
|
190
|
-
this.#
|
|
191
|
-
this.#
|
|
276
|
+
const byteRange = [sliceStart, sliceEnd];
|
|
277
|
+
// this.#log("Found byte ranges", byteRange)
|
|
278
|
+
this.#log(`${byteRange} --> (${sliceStart - delimiterSearchStart})`, debugAsVisibleCharacters(this.#source.subarray(...byteRange)));
|
|
279
|
+
this.#indices.enqueue(byteRange);
|
|
192
280
|
}
|
|
193
281
|
}
|
|
194
282
|
//#endregion
|
|
@@ -199,11 +287,17 @@ export class Spliterator {
|
|
|
199
287
|
next() {
|
|
200
288
|
if (this.#done || this.#yieldCount >= this.#yieldStopCount)
|
|
201
289
|
return this.#finalize();
|
|
202
|
-
if (this.#indices.size
|
|
290
|
+
if (!this.#indices.size)
|
|
203
291
|
this.#fill();
|
|
292
|
+
if (!this.#indices.size) {
|
|
293
|
+
this.#drain();
|
|
204
294
|
}
|
|
205
295
|
const currentByteRange = this.#indices.dequeue();
|
|
206
|
-
this.#
|
|
296
|
+
this.#previousByteRange = currentByteRange;
|
|
297
|
+
if (!currentByteRange) {
|
|
298
|
+
this.#done = true;
|
|
299
|
+
return this.#finalize();
|
|
300
|
+
}
|
|
207
301
|
const [start, end] = currentByteRange;
|
|
208
302
|
const slice = this.#source.subarray(start, end);
|
|
209
303
|
if (slice.length === 0 && this.#skipEmpty) {
|
|
@@ -221,6 +315,9 @@ export class Spliterator {
|
|
|
221
315
|
}
|
|
222
316
|
/**
|
|
223
317
|
* Collect all the byte ranges from the file.
|
|
318
|
+
*
|
|
319
|
+
* @returns An array of encoded byte ranges.
|
|
320
|
+
* @see {@linkcode toDecodedArray} to automatically decode the byte ranges.
|
|
224
321
|
*/
|
|
225
322
|
toArray() {
|
|
226
323
|
return Array.from(this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spliterator.js","sourceRoot":"","sources":["../../lib/Spliterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAyC,MAAM,uBAAuB,CAAA;AAC/F,OAAO,
|
|
1
|
+
{"version":3,"file":"Spliterator.js","sourceRoot":"","sources":["../../lib/Spliterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAyC,MAAM,uBAAuB,CAAA;AAC/F,OAAO,EACN,iBAAiB,EAEjB,wBAAwB,EACxB,uBAAuB,GACvB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAyC,gBAAgB,EAAkB,MAAM,aAAa,CAA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;;OAKG;IACI,OAAO;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxB,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,OAAO,GAAG,IAAI,WAAW,EAAE;QAChD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IAC1D,CAAC;IAEM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAA;IACZ,CAAC"}
|
package/out/lib/shared.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type StatsLike = Pick<Stats, "size" | "blksize" | "mtimeMs">;
|
|
|
12
12
|
/**
|
|
13
13
|
* A trimmed-down version of the Node.js `FileHandle` interface.
|
|
14
14
|
*/
|
|
15
|
-
export type FileHandleLike = Pick<FileHandle, "fd" | "stat" | "close" | "read" | "readableWebStream">;
|
|
15
|
+
export type FileHandleLike = Pick<FileHandle, "fd" | "stat" | "close" | "read" | "readableWebStream" | "createReadStream">;
|
|
16
16
|
/**
|
|
17
17
|
* A tuple representing a window of bytes in a buffer.
|
|
18
18
|
*/
|
|
@@ -74,7 +74,7 @@ export interface ReadBytesOptions {
|
|
|
74
74
|
* While possible with a variety of platform-specific APIs, this trait provides a common interface
|
|
75
75
|
* for reading byte ranges.
|
|
76
76
|
*/
|
|
77
|
-
export interface ByteRangeReader {
|
|
77
|
+
export interface ByteRangeReader extends AsyncIterator<Uint8Array> {
|
|
78
78
|
/**
|
|
79
79
|
* Reads a range of bytes from a source.
|
|
80
80
|
*/
|
|
@@ -106,6 +106,10 @@ export interface FileResourceLike extends File {
|
|
|
106
106
|
blockSize?: number;
|
|
107
107
|
[Symbol.asyncDispose]?(): PromiseLike<void>;
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Type-predicate to determine if a value is a file resource.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isFileResourceLike(input: unknown): input is FileResourceLike;
|
|
109
113
|
/**
|
|
110
114
|
* Given a file resource, adds a `read` method to read a range of bytes.
|
|
111
115
|
*
|
|
@@ -113,19 +117,27 @@ export interface FileResourceLike extends File {
|
|
|
113
117
|
*/
|
|
114
118
|
export declare function applyReaderPolyfill<T extends FileResourceLike>(file: T): asserts file is T & ByteRangeReader;
|
|
115
119
|
/**
|
|
116
|
-
*
|
|
120
|
+
* An asynchronous iterable byte stream.
|
|
121
|
+
*
|
|
122
|
+
* Note that as an iterable this will drained of all bytes when iterated over.
|
|
117
123
|
*/
|
|
118
|
-
export
|
|
124
|
+
export interface AsyncChunkIterator extends AsyncIterable<Uint8Array> {
|
|
125
|
+
/**
|
|
126
|
+
* Disposes of the byte stream, releasing any resources.
|
|
127
|
+
*
|
|
128
|
+
* This method is optional and may not be implemented by all byte streams.
|
|
129
|
+
*/
|
|
130
|
+
[Symbol.asyncDispose]?(): PromiseLike<void>;
|
|
131
|
+
}
|
|
119
132
|
/**
|
|
120
133
|
* An asynchronous resource to a delimited byte stream, which can be a...
|
|
121
134
|
*
|
|
122
135
|
* - `string` representing a file path.
|
|
123
|
-
* -
|
|
124
|
-
* -
|
|
125
|
-
* -
|
|
126
|
-
* - `FileHandleLike` object representing an open file handle.
|
|
136
|
+
* - {@linkcode URL} object representing a file path.
|
|
137
|
+
* - {@linkcode FileHandleLike} object representing an open file handle.
|
|
138
|
+
* - {@linkcode AsyncChunkIterator} object representing an asynchronous byte stream.
|
|
127
139
|
*/
|
|
128
|
-
export type AsyncDataResource = string | URL | FileHandleLike
|
|
140
|
+
export type AsyncDataResource = string | URL | FileHandleLike;
|
|
129
141
|
/**
|
|
130
142
|
* A resource to a delimited byte stream, i.e., a file buffer, handle, or path.
|
|
131
143
|
*
|
package/out/lib/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../lib/shared.ts"],"names":[],"mappings":"AAAA;;;;GAI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Q,CAAC,CAAC,CAAC,GAC/B,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAkBnE"}
|
package/out/lib/shared.js
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
export function isFileHandleLike(input) {
|
|
10
10
|
return Boolean(input && typeof input === "object" && "fd" in input);
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Type-predicate to determine if a value is a file resource.
|
|
14
|
+
*/
|
|
15
|
+
export function isFileResourceLike(input) {
|
|
16
|
+
return Boolean(input && typeof input === "object" && "slice" in input);
|
|
17
|
+
}
|
|
12
18
|
/**
|
|
13
19
|
* Given a file resource, adds a `read` method to read a range of bytes.
|
|
14
20
|
*
|
|
@@ -32,12 +38,6 @@ export function applyReaderPolyfill(file) {
|
|
|
32
38
|
},
|
|
33
39
|
});
|
|
34
40
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Type-predicate to determine if a value is a file resource.
|
|
37
|
-
*/
|
|
38
|
-
export function isFileResourceLike(input) {
|
|
39
|
-
return Boolean(input && typeof input === "object" && "slice" in input);
|
|
40
|
-
}
|
|
41
41
|
export function zippedEntries(zipped) {
|
|
42
42
|
return zipped.slice(0, 2);
|
|
43
43
|
}
|
package/out/lib/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../lib/shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../lib/shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuDH;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC9C,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,CAAC,CAAA;AACpE,CAAC;AA6ED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