strtok3 9.0.0 → 9.0.1

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/LICENSE CHANGED
@@ -1,15 +1,15 @@
1
- Copyright (c) 2017, Borewit
2
- All rights reserved.
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5
- documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
6
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
7
- persons to whom the Software is furnished to do so, subject to the following conditions:
8
-
9
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
- Software.
11
-
12
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
- WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1
+ Copyright (c) 2017, Borewit
2
+ All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
7
+ persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10
+ Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15
15
  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,381 +1,381 @@
1
- [![Node.js CI](https://github.com/Borewit/strtok3/actions/workflows/nodejs-ci.yml/badge.svg?branch=master)](https://github.com/Borewit/strtok3/actions/workflows/nodejs-ci.yml?query=branch%3Amaster)
2
- [![CodeQL](https://github.com/Borewit/strtok3/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/Borewit/strtok3/actions/workflows/codeql.yml)
3
- [![NPM version](https://badge.fury.io/js/strtok3.svg)](https://npmjs.org/package/strtok3)
4
- [![npm downloads](http://img.shields.io/npm/dm/strtok3.svg)](https://npmcharts.com/compare/strtok3,token-types?start=1200&interval=30)
5
- [![DeepScan grade](https://deepscan.io/api/teams/5165/projects/8526/branches/103329/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=8526&bid=103329)
6
- [![Known Vulnerabilities](https://snyk.io/test/github/Borewit/strtok3/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/strtok3?targetFile=package.json)
7
- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/59dd6795e61949fb97066ca52e6097ef)](https://www.codacy.com/app/Borewit/strtok3?utm_source=github.com&utm_medium=referral&utm_content=Borewit/strtok3&utm_campaign=Badge_Grade)
8
- # strtok3
9
-
10
- A promise based streaming [*tokenizer*](#tokenizer-object) for [Node.js](http://nodejs.org) and browsers.
11
-
12
- The `strtok3` module provides several methods for creating a [*tokenizer*](#tokenizer-object) from various input sources.
13
- Designed for:
14
- * Seamless support in streaming environments.
15
- * Efficiently decode binary data, strings, and numbers.
16
- * Reading [predefined](https://github.com/Borewit/token-types) or custom tokens.
17
- * Offering [*tokenizers*](#tokenizer-object) for reading from [files](#method-strtok3fromfile), [streams](#fromstream-function) or [Uint8Arrays](#frombuffer-function).
18
-
19
- ### Features
20
- `strtok3` can read from:
21
- * Files, using a file path as input.
22
- * Node.js [streams](https://nodejs.org/api/stream.html).
23
- * [Buffer](https://nodejs.org/api/buffer.html) or [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
24
- * HTTP chunked transfer provided by [@tokenizer/http](https://github.com/Borewit/tokenizer-http).
25
- * [Amazon S3](https://aws.amazon.com/s3) chunks with [@tokenizer/s3](https://github.com/Borewit/tokenizer-s3).
26
-
27
- ## Installation
28
-
29
- ```sh
30
- npm install strtok3
31
- ```
32
-
33
- ### Compatibility
34
-
35
- Starting with version 7, the module has migrated from [CommonJS](https://en.wikipedia.org/wiki/CommonJS) to [pure ECMAScript Module (ESM)](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
36
- The distributed JavaScript codebase is compliant with the [ECMAScript 2020 (11th Edition)](https://en.wikipedia.org/wiki/ECMAScript_version_history#11th_Edition_%E2%80%93_ECMAScript_2020) standard.
37
-
38
- > [!NOTE]
39
- > This module requires a [Node.js ≥ 16](https://nodejs.org/en/about/previous-releases) engine.
40
- > It can also be used in a browser environment when bundled with a module bundler.
41
-
42
- ## Support the Project
43
- If you find this project useful and would like to support its development, consider sponsoring or contributing:
44
-
45
- - [Become a sponsor to Borewit](https://github.com/sponsors/Borewit)
46
-
47
- - Buy me a coffee:
48
-
49
- <a href="https://www.buymeacoffee.com/borewit" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy me A coffee" height="41" width="174"></a>
50
-
51
- ## API Documentation
52
-
53
- ### strtok3 methods
54
-
55
- Use one of the methods to instantiate an [*abstract tokenizer*](#tokenizer-object):
56
- - [fromFile](#fromfile-function)[^1]
57
- - [fromStream](#fromstream-function)[^1]
58
- - [fromWebStream](#fromwebstream-function)
59
- - [fromBuffer](#frombuffer-function)
60
-
61
- [^1]: Only available when importing this module with Node.js
62
-
63
- All methods return a [`Tokenizer`](#tokenizer-object), either directly or via a promise.
64
-
65
- #### `fromFile` function
66
-
67
- Creates a [*tokenizer*](#tokenizer-object) from a local file.
68
-
69
- ```ts
70
- function fromFile(sourceFilePath: string): Promise<FileTokenizer>
71
- ```
72
-
73
- | Parameter | Type | Description |
74
- |----------------|----------|----------------------------|
75
- | sourceFilePath | `string` | Path to file to read from |
76
-
77
- > [!NOTE]
78
- > - Only available for Node.js engines
79
- > - `fromFile` automatically embeds [file-information](#file-information)
80
-
81
- Returns, via a promise, a [*tokenizer*](#tokenizer-object) which can be used to parse a file.
82
-
83
- ```js
84
- import * as strtok3 from 'strtok3';
85
- import * as Token from 'token-types';
86
-
87
- (async () => {
88
-
89
- const tokenizer = await strtok3.fromFile("somefile.bin");
90
- try {
91
- const myNumber = await tokenizer.readToken(Token.UINT8);
92
- console.log(`My number: ${myNumber}`);
93
- } finally {
94
- tokenizer.close(); // Close the file
95
- }
96
- })();
97
- ```
98
-
99
- #### `fromStream` function
100
-
101
- Creates a [*tokenizer*](#tokenizer-object) from a Node.js [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable).
102
-
103
- ```ts
104
- function fromStream(stream: Readable, options?: ITokenizerOptions): Promise<ReadStreamTokenizer>
105
- ```
106
-
107
- | Parameter | Optional | Type | Description |
108
- |-----------|-----------|-------------------------|--------------------------|
109
- | stream | no | [Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable) | Stream to read from |
110
- | fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information |
111
-
112
- Returns a Promise providing a [*tokenizer*](#tokenizer-object).
113
-
114
- > [!NOTE]
115
- > - Only available for Node.js engines
116
-
117
- #### `fromWebStream` function
118
-
119
- Creates [*tokenizer*](#tokenizer-object) from a [WHATWG ReadableStream](https://nodejs.org/api/webstreams.html#web-streams-api).
120
-
121
- ```ts
122
- function fromWebStream(webStream: AnyWebByteStream, options?: ITokenizerOptions): ReadStreamTokenizer
123
- ```
124
-
125
- | Parameter | Optional | Type | Description |
126
- |----------------|-----------|--------------------------------------------------------------------------|------------------------------------|
127
- | readableStream | no | [ReadableStream](https://nodejs.org/api/webstreams.html#web-streams-api) | WHATWG ReadableStream to read from |
128
- | fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information |
129
-
130
- Returns a Promise providing a [*tokenizer*](#tokenizer-object)
131
-
132
- ```js
133
- import strtok3 from 'strtok3';
134
- import * as Token from 'token-types';
135
-
136
- strtok3.fromWebStream(readableStream).then(tokenizer => {
137
- return tokenizer.readToken(Token.UINT8).then(myUint8Number => {
138
- console.log(`My number: ${myUint8Number}`);
139
- });
140
- });
141
- ```
142
-
143
- #### `fromBuffer()` function
144
-
145
- Create a tokenizer from memory ([Uint8Array](https://nodejs.org/api/buffer.html)).
146
-
147
- ```ts
148
- function fromBuffer(uint8Array: Uint8Array, options?: ITokenizerOptions): BufferTokenizer
149
- ```
150
-
151
- | Parameter | Optional | Type | Description |
152
- |------------|----------|--------------------------------------------------|----------------------------------------|
153
- | uint8Array | no | [Uint8Array](https://nodejs.org/api/buffer.html) | Uint8Array or Buffer to read from |
154
- | fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information |
155
-
156
- Returns a Promise providing a [*tokenizer*](#tokenizer-object).
157
-
158
- ```js
159
- import * as strtok3 from 'strtok3';
160
-
161
- const tokenizer = strtok3.fromBuffer(buffer);
162
-
163
- tokenizer.readToken(Token.UINT8).then(myUint8Number => {
164
- console.log(`My number: ${myUint8Number}`);
165
- });
166
- ```
167
-
168
- ### `Tokenizer` object
169
- The *tokenizer* is an abstraction of a [stream](https://nodejs.org/api/stream.html), file or [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), allowing _reading_ or _peeking_ from the stream.
170
- It can also be translated in chunked reads, as done in [@tokenizer/http](https://github.com/Borewit/tokenizer-http);
171
-
172
- #### Key Features:
173
-
174
- - Supports seeking within the stream using `tokenizer.ignore()`.
175
- - Offers `peek` methods to preview data without advancing the read pointer.
176
- - Maintains the read position via tokenizer.position.
177
-
178
- #### Tokenizer functions
179
-
180
- _Read_ methods advance the stream pointer, while _peek_ methods do not.
181
-
182
- There are two kind of functions:
183
- 1. *read* methods: used to read a *token* of [Buffer](https://nodejs.org/api/buffer.html) from the [*tokenizer*](#tokenizer-object). The position of the *tokenizer-stream* will advance with the size of the token.
184
- 2. *peek* methods: same as the read, but it will *not* advance the pointer. It allows to read (peek) ahead.
185
-
186
- #### `readBuffer` function
187
-
188
- Read data from the _tokenizer_ into provided "buffer" (`Uint8Array`).
189
- `readBuffer(buffer, options?)`
190
-
191
- ```ts
192
- readBuffer(buffer: Uint8Array, options?: IReadChunkOptions): Promise<number>;
193
- ```
194
-
195
- | Parameter | Type | Description |
196
- |------------|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
197
- | buffer | [Buffer](https://nodejs.org/api/buffer.html) &#124; Uint8Array | Target buffer to write the data read to |
198
- | options | [IReadChunkOptions](#ireadchunkoptions) | An integer specifying the number of bytes to read |
199
-
200
- Return promise with number of bytes read.
201
- The number of bytes read maybe if less, *mayBeLess* flag was set.
202
-
203
- #### `peekBuffer` function
204
-
205
- Peek (read ahead), from [*tokenizer*](#tokenizer-object), into the buffer without advancing the stream pointer.
206
-
207
- ```ts
208
- peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise<number>;
209
- ```
210
-
211
- | Parameter | Type | Description |
212
- |------------|-----------------------------------------|-----------------------------------------------------|
213
- | buffer | Buffer &#124; Uint8Array | Target buffer to write the data read (peeked) to. |
214
- | options | [IReadChunkOptions](#ireadchunkoptions) | An integer specifying the number of bytes to read. | |
215
-
216
- Return value `Promise<number>` Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set.
217
-
218
- #### `readToken` function
219
-
220
- Read a *token* from the tokenizer-stream.
221
-
222
- ```ts
223
- readToken<Value>(token: IGetToken<Value>, position: number = this.position): Promise<Value>
224
- ```
225
-
226
- | Parameter | Type | Description |
227
- |------------|-------------------------|---------------------------------------------------------------------------------------------------------------------- |
228
- | token | [IGetToken](#IGetToken) | Token to read from the tokenizer-stream. |
229
- | position? | number | Offset where to begin reading within the file. If position is null, data will be read from the current file position. |
230
-
231
- Return value `Promise<number>`. Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set.
232
-
233
- #### `peek` function
234
-
235
- Peek a *token* from the [*tokenizer*](#tokenizer-object).
236
-
237
- ```ts
238
- peekToken<Value>(token: IGetToken<Value>, position: number = this.position): Promise<Value>
239
- ```
240
-
241
- | Parameter | Type | Description |
242
- |------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------|
243
- | token | [IGetToken<T>](#IGetToken) | Token to read from the tokenizer-stream. |
244
- | position? | number | Offset where to begin reading within the file. If position is null, data will be read from the current file position. |
245
-
246
- Return a promise with the token value peeked from the [*tokenizer*](#tokenizer-object).
247
-
248
- #### `readNumber` function
249
-
250
- Peek a numeric [*token*](#token) from the [*tokenizer*](#tokenizer-object).
251
-
252
- ```ts
253
- readNumber(token: IToken<number>): Promise<number>
254
- ```
255
-
256
- | Parameter | Type | Description |
257
- |------------|---------------------------------|----------------------------------------------------|
258
- | token | [IGetToken<number>](#IGetToken) | Numeric token to read from the tokenizer-stream. |
259
-
260
- Returns a promise with the decoded numeric value from the *tokenizer-stream*.
261
-
262
- #### `ignore` function
263
-
264
- Advance the offset pointer with the token number of bytes provided.
265
-
266
- ```ts
267
- ignore(length: number): Promise<number>
268
- ```
269
-
270
- | Parameter | Type | Description |
271
- |------------|--------|----------------------------------------------------------------------|
272
- | ignore | number | Numeric of bytes to ignore. Will advance the `tokenizer.position` |
273
-
274
- Returns a promise with the decoded numeric value from the *tokenizer-stream*.
275
-
276
- #### `close` function
277
- Clean up resources, such as closing a file pointer if applicable.
278
-
279
- #### `Tokenizer` attributes
280
-
281
- - `fileInfo`
282
-
283
- Optional attribute describing the file information, see [IFileInfo](#IFileInfo)
284
-
285
- - `position`
286
-
287
- Pointer to the current position in the [*tokenizer*](#tokenizer-object) stream.
288
- If a *position* is provided to a _read_ or _peek_ method, is should be, at least, equal or greater than this value.
289
-
290
- ### `IReadChunkOptions` interface
291
-
292
- Each attribute is optional:
293
-
294
- | Attribute | Type | Description |
295
- |-----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
296
- | offset | number | The offset in the buffer to start writing at; if not provided, start at 0 |
297
- | length | number | Requested number of bytes to read. |
298
- | position | number | Position where to peek from the file. If position is null, data will be read from the [current file position](#attribute-tokenizerposition). Position may not be less then [tokenizer.position](#attribute-tokenizerposition) |
299
- | mayBeLess | boolean | If and only if set, will not throw an EOF error if less then the requested *mayBeLess* could be read. |
300
-
301
- Example usage:
302
- ```js
303
- tokenizer.peekBuffer(buffer, {mayBeLess: true});
304
- ```
305
-
306
- ### `IFileInfo` interface
307
-
308
- Provides optional metadata about the file being tokenized.
309
-
310
- | Attribute | Type | Description |
311
- |-----------|---------|---------------------------------------------------------------------------------------------------|
312
- | size | number | File size in bytes |
313
- | mimeType | number | [MIME-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of file. |
314
- | path | number | File path |
315
- | url | boolean | File URL |
316
-
317
- ### `Token` object
318
-
319
- The *token* is basically a description what to read form the [*tokenizer-stream*](#tokenizer-object).
320
- A basic set of *token types* can be found here: [*token-types*](https://github.com/Borewit/token-types).
321
-
322
- A token is something which implements the following interface:
323
- ```ts
324
- export interface IGetToken<T> {
325
-
326
- /**
327
- * Length in bytes of encoded value
328
- */
329
- len: number;
330
-
331
- /**
332
- * Decode value from buffer at offset
333
- * @param buf Buffer to read the decoded value from
334
- * @param off Decode offset
335
- */
336
- get(buf: Uint8Array, off: number): T;
337
- }
338
- ```
339
- The *tokenizer* reads `token.len` bytes from the *tokenizer-stream* into a Buffer.
340
- The `token.get` will be called with the Buffer. `token.get` is responsible for conversion from the buffer to the desired output type.
341
-
342
- ### Working with Web-API readable stream
343
- To convert a [Web-API readable stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader) into a [Node.js readable stream]((https://nodejs.org/api/stream.html#stream_readable_streams)), you can use [readable-web-to-node-stream](https://github.com/Borewit/readable-web-to-node-stream) to convert one in another.
344
-
345
- ```js
346
- import { fromWebStream } strtok3 from 'strtok3';
347
- import { ReadableWebToNodeStream } from 'readable-web-to-node-stream';
348
-
349
- (async () => {
350
-
351
- const response = await fetch(url);
352
- const readableWebStream = response.body; // Web-API readable stream
353
- const webStream = new ReadableWebToNodeStream(readableWebStream); // convert to Node.js readable stream
354
-
355
- const tokenizer = fromWebStream(webStream); // And we now have tokenizer in a web environment
356
- })();
357
- ```
358
-
359
- ## Dependencies
360
-
361
- The diagram below illustrates the primary dependencies of `strtok3`:
362
- ```mermaid
363
- graph TD;
364
- S(strtok3)-->P(peek-readable)
365
- S(strtok3)-->TO("@tokenizer/token")
366
- ```
367
- -
368
- - [peek-readable](https://github.com/Borewit/peek-readable): Manages reading operations with peeking capabilities, allowing data to be previewed without advancing the read pointer.
369
- - [@tokenizer/token](https://github.com/Borewit/tokenizer-token): Provides token definitions and utilities used by `strtok3` for interpreting binary data.
370
-
371
- ## Licence
372
-
373
- (The MIT License)
374
-
375
- Copyright (c) 2024 Borewit
376
-
377
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
378
-
379
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
380
-
381
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ [![Node.js CI](https://github.com/Borewit/strtok3/actions/workflows/nodejs-ci.yml/badge.svg?branch=master)](https://github.com/Borewit/strtok3/actions/workflows/nodejs-ci.yml?query=branch%3Amaster)
2
+ [![CodeQL](https://github.com/Borewit/strtok3/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/Borewit/strtok3/actions/workflows/codeql.yml)
3
+ [![NPM version](https://badge.fury.io/js/strtok3.svg)](https://npmjs.org/package/strtok3)
4
+ [![npm downloads](http://img.shields.io/npm/dm/strtok3.svg)](https://npmcharts.com/compare/strtok3,token-types?start=1200&interval=30)
5
+ [![DeepScan grade](https://deepscan.io/api/teams/5165/projects/8526/branches/103329/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=8526&bid=103329)
6
+ [![Known Vulnerabilities](https://snyk.io/test/github/Borewit/strtok3/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/strtok3?targetFile=package.json)
7
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/59dd6795e61949fb97066ca52e6097ef)](https://www.codacy.com/app/Borewit/strtok3?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Borewit/strtok3&amp;utm_campaign=Badge_Grade)
8
+ # strtok3
9
+
10
+ A promise based streaming [*tokenizer*](#tokenizer-object) for [Node.js](http://nodejs.org) and browsers.
11
+
12
+ The `strtok3` module provides several methods for creating a [*tokenizer*](#tokenizer-object) from various input sources.
13
+ Designed for:
14
+ * Seamless support in streaming environments.
15
+ * Efficiently decode binary data, strings, and numbers.
16
+ * Reading [predefined](https://github.com/Borewit/token-types) or custom tokens.
17
+ * Offering [*tokenizers*](#tokenizer-object) for reading from [files](#method-strtok3fromfile), [streams](#fromstream-function) or [Uint8Arrays](#frombuffer-function).
18
+
19
+ ### Features
20
+ `strtok3` can read from:
21
+ * Files, using a file path as input.
22
+ * Node.js [streams](https://nodejs.org/api/stream.html).
23
+ * [Buffer](https://nodejs.org/api/buffer.html) or [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
24
+ * HTTP chunked transfer provided by [@tokenizer/http](https://github.com/Borewit/tokenizer-http).
25
+ * [Amazon S3](https://aws.amazon.com/s3) chunks with [@tokenizer/s3](https://github.com/Borewit/tokenizer-s3).
26
+
27
+ ## Installation
28
+
29
+ ```sh
30
+ npm install strtok3
31
+ ```
32
+
33
+ ### Compatibility
34
+
35
+ Starting with version 7, the module has migrated from [CommonJS](https://en.wikipedia.org/wiki/CommonJS) to [pure ECMAScript Module (ESM)](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
36
+ The distributed JavaScript codebase is compliant with the [ECMAScript 2020 (11th Edition)](https://en.wikipedia.org/wiki/ECMAScript_version_history#11th_Edition_%E2%80%93_ECMAScript_2020) standard.
37
+
38
+ > [!NOTE]
39
+ > This module requires a [Node.js ≥ 16](https://nodejs.org/en/about/previous-releases) engine.
40
+ > It can also be used in a browser environment when bundled with a module bundler.
41
+
42
+ ## Support the Project
43
+ If you find this project useful and would like to support its development, consider sponsoring or contributing:
44
+
45
+ - [Become a sponsor to Borewit](https://github.com/sponsors/Borewit)
46
+
47
+ - Buy me a coffee:
48
+
49
+ <a href="https://www.buymeacoffee.com/borewit" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy me A coffee" height="41" width="174"></a>
50
+
51
+ ## API Documentation
52
+
53
+ ### strtok3 methods
54
+
55
+ Use one of the methods to instantiate an [*abstract tokenizer*](#tokenizer-object):
56
+ - [fromFile](#fromfile-function)[^1]
57
+ - [fromStream](#fromstream-function)[^1]
58
+ - [fromWebStream](#fromwebstream-function)
59
+ - [fromBuffer](#frombuffer-function)
60
+
61
+ [^1]: Only available when importing this module with Node.js
62
+
63
+ All methods return a [`Tokenizer`](#tokenizer-object), either directly or via a promise.
64
+
65
+ #### `fromFile` function
66
+
67
+ Creates a [*tokenizer*](#tokenizer-object) from a local file.
68
+
69
+ ```ts
70
+ function fromFile(sourceFilePath: string): Promise<FileTokenizer>
71
+ ```
72
+
73
+ | Parameter | Type | Description |
74
+ |----------------|----------|----------------------------|
75
+ | sourceFilePath | `string` | Path to file to read from |
76
+
77
+ > [!NOTE]
78
+ > - Only available for Node.js engines
79
+ > - `fromFile` automatically embeds [file-information](#file-information)
80
+
81
+ Returns, via a promise, a [*tokenizer*](#tokenizer-object) which can be used to parse a file.
82
+
83
+ ```js
84
+ import * as strtok3 from 'strtok3';
85
+ import * as Token from 'token-types';
86
+
87
+ (async () => {
88
+
89
+ const tokenizer = await strtok3.fromFile("somefile.bin");
90
+ try {
91
+ const myNumber = await tokenizer.readToken(Token.UINT8);
92
+ console.log(`My number: ${myNumber}`);
93
+ } finally {
94
+ tokenizer.close(); // Close the file
95
+ }
96
+ })();
97
+ ```
98
+
99
+ #### `fromStream` function
100
+
101
+ Creates a [*tokenizer*](#tokenizer-object) from a Node.js [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable).
102
+
103
+ ```ts
104
+ function fromStream(stream: Readable, options?: ITokenizerOptions): Promise<ReadStreamTokenizer>
105
+ ```
106
+
107
+ | Parameter | Optional | Type | Description |
108
+ |-----------|-----------|-------------------------|--------------------------|
109
+ | stream | no | [Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable) | Stream to read from |
110
+ | fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information |
111
+
112
+ Returns a Promise providing a [*tokenizer*](#tokenizer-object).
113
+
114
+ > [!NOTE]
115
+ > - Only available for Node.js engines
116
+
117
+ #### `fromWebStream` function
118
+
119
+ Creates [*tokenizer*](#tokenizer-object) from a [WHATWG ReadableStream](https://nodejs.org/api/webstreams.html#web-streams-api).
120
+
121
+ ```ts
122
+ function fromWebStream(webStream: AnyWebByteStream, options?: ITokenizerOptions): ReadStreamTokenizer
123
+ ```
124
+
125
+ | Parameter | Optional | Type | Description |
126
+ |----------------|-----------|--------------------------------------------------------------------------|------------------------------------|
127
+ | readableStream | no | [ReadableStream](https://nodejs.org/api/webstreams.html#web-streams-api) | WHATWG ReadableStream to read from |
128
+ | fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information |
129
+
130
+ Returns a Promise providing a [*tokenizer*](#tokenizer-object)
131
+
132
+ ```js
133
+ import strtok3 from 'strtok3';
134
+ import * as Token from 'token-types';
135
+
136
+ strtok3.fromWebStream(readableStream).then(tokenizer => {
137
+ return tokenizer.readToken(Token.UINT8).then(myUint8Number => {
138
+ console.log(`My number: ${myUint8Number}`);
139
+ });
140
+ });
141
+ ```
142
+
143
+ #### `fromBuffer()` function
144
+
145
+ Create a tokenizer from memory ([Uint8Array](https://nodejs.org/api/buffer.html)).
146
+
147
+ ```ts
148
+ function fromBuffer(uint8Array: Uint8Array, options?: ITokenizerOptions): BufferTokenizer
149
+ ```
150
+
151
+ | Parameter | Optional | Type | Description |
152
+ |------------|----------|--------------------------------------------------|----------------------------------------|
153
+ | uint8Array | no | [Uint8Array](https://nodejs.org/api/buffer.html) | Uint8Array or Buffer to read from |
154
+ | fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information |
155
+
156
+ Returns a Promise providing a [*tokenizer*](#tokenizer-object).
157
+
158
+ ```js
159
+ import * as strtok3 from 'strtok3';
160
+
161
+ const tokenizer = strtok3.fromBuffer(buffer);
162
+
163
+ tokenizer.readToken(Token.UINT8).then(myUint8Number => {
164
+ console.log(`My number: ${myUint8Number}`);
165
+ });
166
+ ```
167
+
168
+ ### `Tokenizer` object
169
+ The *tokenizer* is an abstraction of a [stream](https://nodejs.org/api/stream.html), file or [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), allowing _reading_ or _peeking_ from the stream.
170
+ It can also be translated in chunked reads, as done in [@tokenizer/http](https://github.com/Borewit/tokenizer-http);
171
+
172
+ #### Key Features:
173
+
174
+ - Supports seeking within the stream using `tokenizer.ignore()`.
175
+ - Offers `peek` methods to preview data without advancing the read pointer.
176
+ - Maintains the read position via tokenizer.position.
177
+
178
+ #### Tokenizer functions
179
+
180
+ _Read_ methods advance the stream pointer, while _peek_ methods do not.
181
+
182
+ There are two kind of functions:
183
+ 1. *read* methods: used to read a *token* of [Buffer](https://nodejs.org/api/buffer.html) from the [*tokenizer*](#tokenizer-object). The position of the *tokenizer-stream* will advance with the size of the token.
184
+ 2. *peek* methods: same as the read, but it will *not* advance the pointer. It allows to read (peek) ahead.
185
+
186
+ #### `readBuffer` function
187
+
188
+ Read data from the _tokenizer_ into provided "buffer" (`Uint8Array`).
189
+ `readBuffer(buffer, options?)`
190
+
191
+ ```ts
192
+ readBuffer(buffer: Uint8Array, options?: IReadChunkOptions): Promise<number>;
193
+ ```
194
+
195
+ | Parameter | Type | Description |
196
+ |------------|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
197
+ | buffer | [Buffer](https://nodejs.org/api/buffer.html) &#124; Uint8Array | Target buffer to write the data read to |
198
+ | options | [IReadChunkOptions](#ireadchunkoptions) | An integer specifying the number of bytes to read |
199
+
200
+ Return promise with number of bytes read.
201
+ The number of bytes read maybe if less, *mayBeLess* flag was set.
202
+
203
+ #### `peekBuffer` function
204
+
205
+ Peek (read ahead), from [*tokenizer*](#tokenizer-object), into the buffer without advancing the stream pointer.
206
+
207
+ ```ts
208
+ peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise<number>;
209
+ ```
210
+
211
+ | Parameter | Type | Description |
212
+ |------------|-----------------------------------------|-----------------------------------------------------|
213
+ | buffer | Buffer &#124; Uint8Array | Target buffer to write the data read (peeked) to. |
214
+ | options | [IReadChunkOptions](#ireadchunkoptions) | An integer specifying the number of bytes to read. | |
215
+
216
+ Return value `Promise<number>` Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set.
217
+
218
+ #### `readToken` function
219
+
220
+ Read a *token* from the tokenizer-stream.
221
+
222
+ ```ts
223
+ readToken<Value>(token: IGetToken<Value>, position: number = this.position): Promise<Value>
224
+ ```
225
+
226
+ | Parameter | Type | Description |
227
+ |------------|-------------------------|---------------------------------------------------------------------------------------------------------------------- |
228
+ | token | [IGetToken](#IGetToken) | Token to read from the tokenizer-stream. |
229
+ | position? | number | Offset where to begin reading within the file. If position is null, data will be read from the current file position. |
230
+
231
+ Return value `Promise<number>`. Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set.
232
+
233
+ #### `peek` function
234
+
235
+ Peek a *token* from the [*tokenizer*](#tokenizer-object).
236
+
237
+ ```ts
238
+ peekToken<Value>(token: IGetToken<Value>, position: number = this.position): Promise<Value>
239
+ ```
240
+
241
+ | Parameter | Type | Description |
242
+ |------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------|
243
+ | token | [IGetToken<T>](#IGetToken) | Token to read from the tokenizer-stream. |
244
+ | position? | number | Offset where to begin reading within the file. If position is null, data will be read from the current file position. |
245
+
246
+ Return a promise with the token value peeked from the [*tokenizer*](#tokenizer-object).
247
+
248
+ #### `readNumber` function
249
+
250
+ Peek a numeric [*token*](#token) from the [*tokenizer*](#tokenizer-object).
251
+
252
+ ```ts
253
+ readNumber(token: IToken<number>): Promise<number>
254
+ ```
255
+
256
+ | Parameter | Type | Description |
257
+ |------------|---------------------------------|----------------------------------------------------|
258
+ | token | [IGetToken<number>](#IGetToken) | Numeric token to read from the tokenizer-stream. |
259
+
260
+ Returns a promise with the decoded numeric value from the *tokenizer-stream*.
261
+
262
+ #### `ignore` function
263
+
264
+ Advance the offset pointer with the token number of bytes provided.
265
+
266
+ ```ts
267
+ ignore(length: number): Promise<number>
268
+ ```
269
+
270
+ | Parameter | Type | Description |
271
+ |------------|--------|----------------------------------------------------------------------|
272
+ | ignore | number | Numeric of bytes to ignore. Will advance the `tokenizer.position` |
273
+
274
+ Returns a promise with the decoded numeric value from the *tokenizer-stream*.
275
+
276
+ #### `close` function
277
+ Clean up resources, such as closing a file pointer if applicable.
278
+
279
+ #### `Tokenizer` attributes
280
+
281
+ - `fileInfo`
282
+
283
+ Optional attribute describing the file information, see [IFileInfo](#IFileInfo)
284
+
285
+ - `position`
286
+
287
+ Pointer to the current position in the [*tokenizer*](#tokenizer-object) stream.
288
+ If a *position* is provided to a _read_ or _peek_ method, is should be, at least, equal or greater than this value.
289
+
290
+ ### `IReadChunkOptions` interface
291
+
292
+ Each attribute is optional:
293
+
294
+ | Attribute | Type | Description |
295
+ |-----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
296
+ | offset | number | The offset in the buffer to start writing at; if not provided, start at 0 |
297
+ | length | number | Requested number of bytes to read. |
298
+ | position | number | Position where to peek from the file. If position is null, data will be read from the [current file position](#attribute-tokenizerposition). Position may not be less then [tokenizer.position](#attribute-tokenizerposition) |
299
+ | mayBeLess | boolean | If and only if set, will not throw an EOF error if less then the requested *mayBeLess* could be read. |
300
+
301
+ Example usage:
302
+ ```js
303
+ tokenizer.peekBuffer(buffer, {mayBeLess: true});
304
+ ```
305
+
306
+ ### `IFileInfo` interface
307
+
308
+ Provides optional metadata about the file being tokenized.
309
+
310
+ | Attribute | Type | Description |
311
+ |-----------|---------|---------------------------------------------------------------------------------------------------|
312
+ | size | number | File size in bytes |
313
+ | mimeType | number | [MIME-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of file. |
314
+ | path | number | File path |
315
+ | url | boolean | File URL |
316
+
317
+ ### `Token` object
318
+
319
+ The *token* is basically a description what to read form the [*tokenizer-stream*](#tokenizer-object).
320
+ A basic set of *token types* can be found here: [*token-types*](https://github.com/Borewit/token-types).
321
+
322
+ A token is something which implements the following interface:
323
+ ```ts
324
+ export interface IGetToken<T> {
325
+
326
+ /**
327
+ * Length in bytes of encoded value
328
+ */
329
+ len: number;
330
+
331
+ /**
332
+ * Decode value from buffer at offset
333
+ * @param buf Buffer to read the decoded value from
334
+ * @param off Decode offset
335
+ */
336
+ get(buf: Uint8Array, off: number): T;
337
+ }
338
+ ```
339
+ The *tokenizer* reads `token.len` bytes from the *tokenizer-stream* into a Buffer.
340
+ The `token.get` will be called with the Buffer. `token.get` is responsible for conversion from the buffer to the desired output type.
341
+
342
+ ### Working with Web-API readable stream
343
+ To convert a [Web-API readable stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader) into a [Node.js readable stream]((https://nodejs.org/api/stream.html#stream_readable_streams)), you can use [readable-web-to-node-stream](https://github.com/Borewit/readable-web-to-node-stream) to convert one in another.
344
+
345
+ ```js
346
+ import { fromWebStream } strtok3 from 'strtok3';
347
+ import { ReadableWebToNodeStream } from 'readable-web-to-node-stream';
348
+
349
+ (async () => {
350
+
351
+ const response = await fetch(url);
352
+ const readableWebStream = response.body; // Web-API readable stream
353
+ const webStream = new ReadableWebToNodeStream(readableWebStream); // convert to Node.js readable stream
354
+
355
+ const tokenizer = fromWebStream(webStream); // And we now have tokenizer in a web environment
356
+ })();
357
+ ```
358
+
359
+ ## Dependencies
360
+
361
+ The diagram below illustrates the primary dependencies of `strtok3`:
362
+ ```mermaid
363
+ graph TD;
364
+ S(strtok3)-->P(peek-readable)
365
+ S(strtok3)-->TO("@tokenizer/token")
366
+ ```
367
+ -
368
+ - [peek-readable](https://github.com/Borewit/peek-readable): Manages reading operations with peeking capabilities, allowing data to be previewed without advancing the read pointer.
369
+ - [@tokenizer/token](https://github.com/Borewit/tokenizer-token): Provides token definitions and utilities used by `strtok3` for interpreting binary data.
370
+
371
+ ## Licence
372
+
373
+ (The MIT License)
374
+
375
+ Copyright (c) 2024 Borewit
376
+
377
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
378
+
379
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
380
+
381
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -87,6 +87,7 @@ export class AbstractTokenizer {
87
87
  return length;
88
88
  }
89
89
  async close() {
90
+ await this.abort();
90
91
  await this.onClose?.();
91
92
  }
92
93
  normalizeOptions(uint8Array, options) {
package/package.json CHANGED
@@ -1,91 +1,91 @@
1
- {
2
- "name": "strtok3",
3
- "version": "9.0.0",
4
- "description": "A promise based streaming tokenizer",
5
- "author": {
6
- "name": "Borewit",
7
- "url": "https://github.com/Borewit"
8
- },
9
- "funding": {
10
- "type": "github",
11
- "url": "https://github.com/sponsors/Borewit"
12
- },
13
- "scripts": {
14
- "clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map'",
15
- "compile-src": "tsc -p lib",
16
- "compile-test": "tsc -p test",
17
- "compile": "yarn run compile-src && yarn run compile-test",
18
- "build": "yarn run clean && yarn run compile",
19
- "eslint": "eslint lib test",
20
- "lint-md": "remark -u preset-lint-recommended .",
21
- "lint-ts": "biome check",
22
- "lint": "yarn run lint-md && yarn run lint-ts",
23
- "fix": "yarn run biome lint --write",
24
- "test": "mocha",
25
- "test-coverage": "c8 yarn run test",
26
- "send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
27
- "start": "yarn run compile && yarn run lint && yarn run cover-test"
28
- },
29
- "engines": {
30
- "node": ">=16"
31
- },
32
- "repository": {
33
- "type": "git",
34
- "url": "https://github.com/Borewit/strtok3.git"
35
- },
36
- "license": "MIT",
37
- "type": "module",
38
- "exports": {
39
- ".": {
40
- "node": "./lib/index.js",
41
- "default": "./lib/core.js"
42
- },
43
- "./core": "./lib/core.js"
44
- },
45
- "types": "lib/index.d.ts",
46
- "files": [
47
- "lib/**/*.js",
48
- "lib/**/*.d.ts"
49
- ],
50
- "bugs": {
51
- "url": "https://github.com/Borewit/strtok3/issues"
52
- },
53
- "devDependencies": {
54
- "@biomejs/biome": "^1.8.3",
55
- "@types/chai": "^4.3.17",
56
- "@types/chai-as-promised": "^8.0.0",
57
- "@types/debug": "^4.1.12",
58
- "@types/mocha": "^10.0.7",
59
- "@types/node": "^22.2.0",
60
- "c8": "^10.1.2",
61
- "chai": "^5.1.1",
62
- "chai-as-promised": "^8.0.0",
63
- "del-cli": "^5.1.0",
64
- "mocha": "^10.7.3",
65
- "remark-cli": "^12.0.1",
66
- "remark-preset-lint-recommended": "^7.0.0",
67
- "token-types": "^6.0.0",
68
- "ts-node": "^10.9.2",
69
- "typescript": "^5.5.4",
70
- "uint8array-extras": "^1.4.0"
71
- },
72
- "dependencies": {
73
- "@tokenizer/token": "^0.3.0",
74
- "peek-readable": "^5.2.0"
75
- },
76
- "keywords": [
77
- "tokenizer",
78
- "reader",
79
- "token",
80
- "async",
81
- "promise",
82
- "parser",
83
- "decoder",
84
- "binary",
85
- "endian",
86
- "uint",
87
- "stream",
88
- "streaming"
89
- ],
90
- "packageManager": "yarn@4.3.1"
91
- }
1
+ {
2
+ "name": "strtok3",
3
+ "version": "9.0.1",
4
+ "description": "A promise based streaming tokenizer",
5
+ "author": {
6
+ "name": "Borewit",
7
+ "url": "https://github.com/Borewit"
8
+ },
9
+ "funding": {
10
+ "type": "github",
11
+ "url": "https://github.com/sponsors/Borewit"
12
+ },
13
+ "scripts": {
14
+ "clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map'",
15
+ "compile-src": "tsc -p lib",
16
+ "compile-test": "tsc -p test",
17
+ "compile": "yarn run compile-src && yarn run compile-test",
18
+ "build": "yarn run clean && yarn run compile",
19
+ "eslint": "eslint lib test",
20
+ "lint-md": "remark -u preset-lint-recommended .",
21
+ "lint-ts": "biome check",
22
+ "lint": "yarn run lint-md && yarn run lint-ts",
23
+ "fix": "yarn run biome lint --write",
24
+ "test": "mocha",
25
+ "test-coverage": "c8 yarn run test",
26
+ "send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
27
+ "start": "yarn run compile && yarn run lint && yarn run cover-test"
28
+ },
29
+ "engines": {
30
+ "node": ">=16"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/Borewit/strtok3.git"
35
+ },
36
+ "license": "MIT",
37
+ "type": "module",
38
+ "exports": {
39
+ ".": {
40
+ "node": "./lib/index.js",
41
+ "default": "./lib/core.js"
42
+ },
43
+ "./core": "./lib/core.js"
44
+ },
45
+ "types": "lib/index.d.ts",
46
+ "files": [
47
+ "lib/**/*.js",
48
+ "lib/**/*.d.ts"
49
+ ],
50
+ "bugs": {
51
+ "url": "https://github.com/Borewit/strtok3/issues"
52
+ },
53
+ "devDependencies": {
54
+ "@biomejs/biome": "^1.9.3",
55
+ "@types/chai": "^5.0.0",
56
+ "@types/chai-as-promised": "^8.0.1",
57
+ "@types/debug": "^4.1.12",
58
+ "@types/mocha": "^10.0.9",
59
+ "@types/node": "^22.7.5",
60
+ "c8": "^10.1.2",
61
+ "chai": "^5.1.1",
62
+ "chai-as-promised": "^8.0.0",
63
+ "del-cli": "^6.0.0",
64
+ "mocha": "^10.7.3",
65
+ "remark-cli": "^12.0.1",
66
+ "remark-preset-lint-recommended": "^7.0.0",
67
+ "token-types": "^6.0.0",
68
+ "ts-node": "^10.9.2",
69
+ "typescript": "^5.6.3",
70
+ "uint8array-extras": "^1.4.0"
71
+ },
72
+ "dependencies": {
73
+ "@tokenizer/token": "^0.3.0",
74
+ "peek-readable": "^5.3.1"
75
+ },
76
+ "keywords": [
77
+ "tokenizer",
78
+ "reader",
79
+ "token",
80
+ "async",
81
+ "promise",
82
+ "parser",
83
+ "decoder",
84
+ "binary",
85
+ "endian",
86
+ "uint",
87
+ "stream",
88
+ "streaming"
89
+ ],
90
+ "packageManager": "yarn@4.3.1"
91
+ }