bireader 3.1.15 → 4.0.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 +259 -123
- package/dist/index.browser.d.ts +253 -196
- package/dist/index.browser.js +1135 -540
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.d.ts +6595 -358
- package/dist/index.cjs.js +14251 -1327
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +6595 -358
- package/dist/index.esm.d.ts +6595 -358
- package/dist/index.esm.js +14247 -1328
- package/dist/index.esm.js.map +1 -1
- package/package.json +15 -4
- package/rollup.config.mjs +81 -0
package/dist/index.browser.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
type endian = "little" | "big";
|
|
3
2
|
type BigValue = number | bigint;
|
|
4
3
|
type BiOptions = {
|
|
@@ -28,6 +27,10 @@ type BiOptions = {
|
|
|
28
27
|
* Set this to ``true`` if you wish for it to always stay a ``BigInt``.
|
|
29
28
|
*/
|
|
30
29
|
enforceBigInt?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Allow data writes when reading a file
|
|
32
|
+
*/
|
|
33
|
+
writeable?: boolean;
|
|
31
34
|
};
|
|
32
35
|
type hexdumpOptions = {
|
|
33
36
|
/**
|
|
@@ -93,7 +96,19 @@ type stringOptions = {
|
|
|
93
96
|
endian?: "big" | "little";
|
|
94
97
|
};
|
|
95
98
|
|
|
96
|
-
|
|
99
|
+
/**
|
|
100
|
+
* For file system in Node
|
|
101
|
+
*/
|
|
102
|
+
type FileDescriptor = number;
|
|
103
|
+
/**
|
|
104
|
+
* file system read modes
|
|
105
|
+
*/
|
|
106
|
+
type fsMode = "w+" | "r";
|
|
107
|
+
/**
|
|
108
|
+
* Base class for BiReader and BiWriter
|
|
109
|
+
*/
|
|
110
|
+
declare class BiBase<DataType extends Buffer | Uint8Array, hasBigInt extends boolean> {
|
|
111
|
+
#private;
|
|
97
112
|
/**
|
|
98
113
|
* Endianness of default read.
|
|
99
114
|
* @type {endian}
|
|
@@ -123,11 +138,6 @@ declare class BiBase {
|
|
|
123
138
|
* Console log a hexdump on error.
|
|
124
139
|
*/
|
|
125
140
|
errorDump: boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Current buffer data.
|
|
128
|
-
* @type {Buffer|Uint8Array|null}
|
|
129
|
-
*/
|
|
130
|
-
data: Buffer | Uint8Array | null;
|
|
131
141
|
/**
|
|
132
142
|
* When the data buffer needs to be extended while strict mode is ``false``, this will be the amount it extends.
|
|
133
143
|
*
|
|
@@ -138,16 +148,33 @@ declare class BiBase {
|
|
|
138
148
|
* NOTE: Using ``BiWriter.get`` or ``BiWriter.return`` will now remove all data after the current write position. Use ``BiWriter.data`` to get the full buffer instead.
|
|
139
149
|
*/
|
|
140
150
|
extendBufferSize: number;
|
|
141
|
-
fd:
|
|
142
|
-
filePath: string;
|
|
143
|
-
fsMode:
|
|
151
|
+
fd: FileDescriptor | null;
|
|
152
|
+
filePath: string | null;
|
|
153
|
+
fsMode: fsMode;
|
|
144
154
|
/**
|
|
145
155
|
* The settings that used when using the .str getter / setter
|
|
146
156
|
*/
|
|
147
157
|
private strDefaults;
|
|
158
|
+
/**
|
|
159
|
+
* Window size of the file data (largest amount it can read)
|
|
160
|
+
*/
|
|
148
161
|
maxFileSize: number | null;
|
|
149
|
-
enforceBigInt:
|
|
150
|
-
|
|
162
|
+
enforceBigInt: hasBigInt;
|
|
163
|
+
view: DataView;
|
|
164
|
+
mode: 'memory' | 'file';
|
|
165
|
+
/**
|
|
166
|
+
* Get the current buffer data.
|
|
167
|
+
*
|
|
168
|
+
* @type {DataType}
|
|
169
|
+
*/
|
|
170
|
+
get data(): DataType;
|
|
171
|
+
/**
|
|
172
|
+
* Set the current buffer data.
|
|
173
|
+
*
|
|
174
|
+
* @param {DataType} data
|
|
175
|
+
*/
|
|
176
|
+
set data(data: DataType);
|
|
177
|
+
constructor(input?: string | DataType, writeable?: boolean);
|
|
151
178
|
/**
|
|
152
179
|
* Settings for when using .str
|
|
153
180
|
*
|
|
@@ -161,39 +188,64 @@ declare class BiBase {
|
|
|
161
188
|
*/
|
|
162
189
|
writeMode(mode: boolean): void;
|
|
163
190
|
/**
|
|
164
|
-
*
|
|
191
|
+
* Opens the file in `file` mode. Must be run before reading or writing.
|
|
192
|
+
*
|
|
193
|
+
* @returns {number} file size
|
|
165
194
|
*/
|
|
166
195
|
open(): number;
|
|
167
196
|
/**
|
|
168
|
-
*
|
|
197
|
+
* Internal update size
|
|
169
198
|
*/
|
|
170
199
|
updateSize(): void;
|
|
171
200
|
/**
|
|
172
|
-
* removes
|
|
201
|
+
* commit data and removes it.
|
|
173
202
|
*/
|
|
174
203
|
close(): void;
|
|
175
204
|
/**
|
|
176
|
-
*
|
|
205
|
+
* Write buffer to data
|
|
206
|
+
*
|
|
207
|
+
* @param {DataType} data
|
|
208
|
+
* @param {boolean} consume
|
|
209
|
+
* @param {number} start - likely this.offset
|
|
210
|
+
* @returns {Buffer | Uint8Array}
|
|
211
|
+
*/
|
|
212
|
+
write(data: DataType, consume?: boolean, start?: number): DataType;
|
|
213
|
+
/**
|
|
214
|
+
* Write data buffer back to file
|
|
215
|
+
*
|
|
216
|
+
* @returns {DataType}
|
|
177
217
|
*/
|
|
178
|
-
|
|
218
|
+
commit(): DataType;
|
|
179
219
|
/**
|
|
180
|
-
*
|
|
220
|
+
* syncs the data to file
|
|
181
221
|
*/
|
|
182
|
-
|
|
222
|
+
flush(): void;
|
|
183
223
|
/**
|
|
184
|
-
*
|
|
224
|
+
* Renames the file you are working on.
|
|
225
|
+
*
|
|
226
|
+
* Must be full file path and file name.
|
|
227
|
+
*
|
|
228
|
+
* Keeps write / read position.
|
|
229
|
+
*
|
|
230
|
+
* Note: This is permanent and can't be undone.
|
|
231
|
+
*
|
|
232
|
+
* @param {string} newFilePath - New full file path and name.
|
|
185
233
|
*/
|
|
186
|
-
renameFile(): void;
|
|
234
|
+
renameFile(newFilePath: string): void;
|
|
187
235
|
/**
|
|
188
|
-
*
|
|
236
|
+
* Deletes the working file.
|
|
237
|
+
*
|
|
238
|
+
* Note: This is permanentand can't be undone.
|
|
239
|
+
*
|
|
240
|
+
* It doesn't send the file to the recycling bin for recovery.
|
|
189
241
|
*/
|
|
190
242
|
deleteFile(): void;
|
|
243
|
+
extendArray(to_padd: number): void;
|
|
244
|
+
isBufferOrUint8Array(obj: any): boolean;
|
|
191
245
|
/**
|
|
192
|
-
*
|
|
246
|
+
* Call this after everytime we set/replace `this.data`
|
|
193
247
|
*/
|
|
194
|
-
|
|
195
|
-
extendArray(to_padd: number): void;
|
|
196
|
-
isBufferOrUint8Array(obj: Buffer | Uint8Array): boolean;
|
|
248
|
+
updateView(): void;
|
|
197
249
|
/**
|
|
198
250
|
*
|
|
199
251
|
* Change endian, defaults to little.
|
|
@@ -266,85 +318,85 @@ declare class BiBase {
|
|
|
266
318
|
/**
|
|
267
319
|
* Get the current byte position.
|
|
268
320
|
*
|
|
269
|
-
* @
|
|
321
|
+
* @returns {number} current byte position
|
|
270
322
|
*/
|
|
271
323
|
get tell(): number;
|
|
272
324
|
/**
|
|
273
325
|
* Get the current byte position.
|
|
274
326
|
*
|
|
275
|
-
* @
|
|
327
|
+
* @returns {number} current byte position
|
|
276
328
|
*/
|
|
277
329
|
get FTell(): number;
|
|
278
330
|
/**
|
|
279
331
|
* Get the current byte position.
|
|
280
332
|
*
|
|
281
|
-
* @
|
|
333
|
+
* @returns {number} current byte position
|
|
282
334
|
*/
|
|
283
335
|
get getOffset(): number;
|
|
284
336
|
/**
|
|
285
337
|
* Get the current byte position;
|
|
286
338
|
*
|
|
287
|
-
* @
|
|
339
|
+
* @returns {number} current byte position
|
|
288
340
|
*/
|
|
289
341
|
get saveOffset(): number;
|
|
290
342
|
/**
|
|
291
343
|
* Get the current byte position;
|
|
292
344
|
*
|
|
293
|
-
* @
|
|
345
|
+
* @returns {number} current byte position
|
|
294
346
|
*/
|
|
295
347
|
get off(): number;
|
|
296
348
|
/**
|
|
297
349
|
* Get the current bit position (0-7).
|
|
298
350
|
*
|
|
299
|
-
* @
|
|
351
|
+
* @returns {number} current bit position
|
|
300
352
|
*/
|
|
301
353
|
get getOffsetBit(): number;
|
|
302
354
|
/**
|
|
303
355
|
* Get the current bit position (0-7).
|
|
304
356
|
*
|
|
305
|
-
* @
|
|
357
|
+
* @returns {number} current bit position
|
|
306
358
|
*/
|
|
307
359
|
get tellB(): number;
|
|
308
360
|
/**
|
|
309
361
|
* Get the current bit position (0-7).
|
|
310
362
|
*
|
|
311
|
-
* @
|
|
363
|
+
* @returns {number} current bit position
|
|
312
364
|
*/
|
|
313
365
|
get FTellB(): number;
|
|
314
366
|
/**
|
|
315
367
|
* Get the current bit position (0-7).
|
|
316
368
|
*
|
|
317
|
-
* @
|
|
369
|
+
* @returns {number} current bit position
|
|
318
370
|
*/
|
|
319
371
|
get offb(): number;
|
|
320
372
|
/**
|
|
321
373
|
* Get the current absolute bit position (from start of data).
|
|
322
374
|
*
|
|
323
|
-
* @
|
|
375
|
+
* @returns {number} current absolute bit position
|
|
324
376
|
*/
|
|
325
377
|
get getOffsetAbsBit(): number;
|
|
326
378
|
/**
|
|
327
379
|
* Get the current absolute bit position (from start of data).
|
|
328
380
|
*
|
|
329
|
-
* @
|
|
381
|
+
* @returns {number} current bit position
|
|
330
382
|
*/
|
|
331
383
|
get saveOffsetAbsBit(): number;
|
|
332
384
|
/**
|
|
333
385
|
* Get the current absolute bit position (from start of data).
|
|
334
386
|
*
|
|
335
|
-
* @
|
|
387
|
+
* @returns {number} current absolute bit position
|
|
336
388
|
*/
|
|
337
389
|
get tellAbsB(): number;
|
|
338
390
|
/**
|
|
339
391
|
* Get the current absolute bit position (from start of data).
|
|
340
392
|
*
|
|
341
|
-
* @
|
|
393
|
+
* @returns {number} current absolute bit position
|
|
342
394
|
*/
|
|
343
395
|
get saveOffsetBit(): number;
|
|
344
396
|
/**
|
|
345
397
|
* Get the current absolute bit position (from start of data).
|
|
346
398
|
*
|
|
347
|
-
* @
|
|
399
|
+
* @returns {number} current absolute bit position
|
|
348
400
|
*/
|
|
349
401
|
get offab(): number;
|
|
350
402
|
/**
|
|
@@ -390,9 +442,9 @@ declare class BiBase {
|
|
|
390
442
|
*
|
|
391
443
|
* Use ``.data`` instead if you want the full buffer data.
|
|
392
444
|
*
|
|
393
|
-
* @returns {
|
|
445
|
+
* @returns {DataType} ``Buffer`` or ``Uint8Array``
|
|
394
446
|
*/
|
|
395
|
-
get
|
|
447
|
+
get(): DataType;
|
|
396
448
|
/**
|
|
397
449
|
* Returns current data.
|
|
398
450
|
*
|
|
@@ -400,9 +452,9 @@ declare class BiBase {
|
|
|
400
452
|
*
|
|
401
453
|
* Use ``.data`` instead if you want the full buffer data.
|
|
402
454
|
*
|
|
403
|
-
* @returns {
|
|
455
|
+
* @returns {DataType} ``Buffer`` or ``Uint8Array``
|
|
404
456
|
*/
|
|
405
|
-
|
|
457
|
+
return(): DataType;
|
|
406
458
|
/**
|
|
407
459
|
* Creates hex dump string. Will console log or return string if set in options.
|
|
408
460
|
*
|
|
@@ -432,14 +484,20 @@ declare class BiBase {
|
|
|
432
484
|
unrestrict(): void;
|
|
433
485
|
/**
|
|
434
486
|
* removes data.
|
|
487
|
+
*
|
|
488
|
+
* Commits any changes to file when editing a file.
|
|
435
489
|
*/
|
|
436
490
|
end(): void;
|
|
437
491
|
/**
|
|
438
492
|
* removes data.
|
|
493
|
+
*
|
|
494
|
+
* Commits any changes to file when editing a file.
|
|
439
495
|
*/
|
|
440
496
|
done(): void;
|
|
441
497
|
/**
|
|
442
498
|
* removes data.
|
|
499
|
+
*
|
|
500
|
+
* Commits any changes to file when editing a file.
|
|
443
501
|
*/
|
|
444
502
|
finished(): void;
|
|
445
503
|
/**
|
|
@@ -640,25 +698,25 @@ declare class BiBase {
|
|
|
640
698
|
* @param {number} startOffset - Start location (default 0)
|
|
641
699
|
* @param {number} endOffset - End location (default current position)
|
|
642
700
|
* @param {boolean} consume - Move position to end of removed data (default false)
|
|
643
|
-
* @returns {
|
|
701
|
+
* @returns {DataType} Removed data as ``Buffer`` or ``Uint8Array``
|
|
644
702
|
*/
|
|
645
|
-
delete(startOffset?: number, endOffset?: number, consume?: boolean):
|
|
703
|
+
delete(startOffset?: number, endOffset?: number, consume?: boolean): DataType;
|
|
646
704
|
/**
|
|
647
705
|
* Deletes part of data from current byte position to end, returns removed.
|
|
648
706
|
*
|
|
649
707
|
* Note: Errors in strict mode.
|
|
650
708
|
*
|
|
651
|
-
* @returns {
|
|
709
|
+
* @returns {DataType} Removed data as ``Buffer`` or ``Uint8Array``
|
|
652
710
|
*/
|
|
653
|
-
clip():
|
|
711
|
+
clip(): DataType;
|
|
654
712
|
/**
|
|
655
713
|
* Deletes part of data from current byte position to end, returns removed.
|
|
656
714
|
*
|
|
657
715
|
* Note: Errors in strict mode.
|
|
658
716
|
*
|
|
659
|
-
* @returns {
|
|
717
|
+
* @returns {DataType} Removed data as ``Buffer`` or ``Uint8Array``
|
|
660
718
|
*/
|
|
661
|
-
trim():
|
|
719
|
+
trim(): DataType;
|
|
662
720
|
/**
|
|
663
721
|
* Deletes part of data from current byte position to supplied length, returns removed.
|
|
664
722
|
*
|
|
@@ -666,9 +724,9 @@ declare class BiBase {
|
|
|
666
724
|
*
|
|
667
725
|
* @param {number} length - Length of data in bytes to remove
|
|
668
726
|
* @param {boolean} consume - Move position to end of removed data (default false)
|
|
669
|
-
* @returns {
|
|
727
|
+
* @returns {TemplateStringsArray} Removed data as ``Buffer`` or ``Uint8Array``
|
|
670
728
|
*/
|
|
671
|
-
crop(length: number, consume?: boolean):
|
|
729
|
+
crop(length: number, consume?: boolean): DataType;
|
|
672
730
|
/**
|
|
673
731
|
* Deletes part of data from current position to supplied length, returns removed.
|
|
674
732
|
*
|
|
@@ -676,29 +734,29 @@ declare class BiBase {
|
|
|
676
734
|
*
|
|
677
735
|
* @param {number} length - Length of data in bytes to remove
|
|
678
736
|
* @param {boolean} consume - Move position to end of removed data (default false)
|
|
679
|
-
* @returns {
|
|
737
|
+
* @returns {DataType} Removed data as ``Buffer`` or ``Uint8Array``
|
|
680
738
|
*/
|
|
681
|
-
drop(length: number, consume?: boolean):
|
|
739
|
+
drop(length: number, consume?: boolean): DataType;
|
|
682
740
|
/**
|
|
683
741
|
* Replaces data in data.
|
|
684
742
|
*
|
|
685
743
|
* Note: Errors on strict mode.
|
|
686
744
|
*
|
|
687
|
-
* @param {
|
|
745
|
+
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
688
746
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
689
747
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
690
748
|
*/
|
|
691
|
-
replace(data:
|
|
749
|
+
replace(data: DataType, consume?: boolean, offset?: number): void;
|
|
692
750
|
/**
|
|
693
751
|
* Replaces data in data.
|
|
694
752
|
*
|
|
695
753
|
* Note: Errors on strict mode.
|
|
696
754
|
*
|
|
697
|
-
* @param {
|
|
755
|
+
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
698
756
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
699
757
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
700
758
|
*/
|
|
701
|
-
overwrite(data:
|
|
759
|
+
overwrite(data: DataType, consume?: boolean, offset?: number): void;
|
|
702
760
|
/**
|
|
703
761
|
* Returns part of data from current byte position to end of data unless supplied.
|
|
704
762
|
*
|
|
@@ -706,9 +764,9 @@ declare class BiBase {
|
|
|
706
764
|
* @param {number} endOffset - End location (default end of data)
|
|
707
765
|
* @param {boolean} consume - Move position to end of lifted data (default false)
|
|
708
766
|
* @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
|
|
709
|
-
* @returns {
|
|
767
|
+
* @returns {DataType} Selected data as ``Uint8Array`` or ``Buffer``
|
|
710
768
|
*/
|
|
711
|
-
lift(startOffset?: number, endOffset?: number, consume?: boolean, fillValue?: number):
|
|
769
|
+
lift(startOffset?: number, endOffset?: number, consume?: boolean, fillValue?: number): DataType;
|
|
712
770
|
/**
|
|
713
771
|
* Returns part of data from current byte position to end of data unless supplied.
|
|
714
772
|
*
|
|
@@ -716,9 +774,9 @@ declare class BiBase {
|
|
|
716
774
|
* @param {number} endOffset - End location (default end of data)
|
|
717
775
|
* @param {boolean} consume - Move position to end of lifted data (default false)
|
|
718
776
|
* @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
|
|
719
|
-
* @returns {
|
|
777
|
+
* @returns {DataType} Selected data as ``Uint8Array`` or ``Buffer``
|
|
720
778
|
*/
|
|
721
|
-
fill(startOffset?: number, endOffset?: number, consume?: boolean, fillValue?: number):
|
|
779
|
+
fill(startOffset?: number, endOffset?: number, consume?: boolean, fillValue?: number): DataType;
|
|
722
780
|
/**
|
|
723
781
|
* Extract data from current position to length supplied.
|
|
724
782
|
*
|
|
@@ -726,9 +784,9 @@ declare class BiBase {
|
|
|
726
784
|
*
|
|
727
785
|
* @param {number} length - Length of data in bytes to copy from current offset
|
|
728
786
|
* @param {number} consume - Moves offset to end of length
|
|
729
|
-
* @returns {
|
|
787
|
+
* @returns {DataType} Selected data as ``Uint8Array`` or ``Buffer``
|
|
730
788
|
*/
|
|
731
|
-
extract(length: number, consume?: boolean):
|
|
789
|
+
extract(length: number, consume?: boolean): DataType;
|
|
732
790
|
/**
|
|
733
791
|
* Extract data from current position to length supplied.
|
|
734
792
|
*
|
|
@@ -736,9 +794,9 @@ declare class BiBase {
|
|
|
736
794
|
*
|
|
737
795
|
* @param {number} length - Length of data in bytes to copy from current offset
|
|
738
796
|
* @param {number} consume - Moves offset to end of length
|
|
739
|
-
* @returns {
|
|
797
|
+
* @returns {DataType} Selected data as ``Uint8Array`` or ``Buffer``
|
|
740
798
|
*/
|
|
741
|
-
slice(length: number, consume?: boolean):
|
|
799
|
+
slice(length: number, consume?: boolean): DataType;
|
|
742
800
|
/**
|
|
743
801
|
* Extract data from current position to length supplied.
|
|
744
802
|
*
|
|
@@ -746,65 +804,65 @@ declare class BiBase {
|
|
|
746
804
|
*
|
|
747
805
|
* @param {number} length - Length of data in bytes to copy from current offset
|
|
748
806
|
* @param {number} consume - Moves offset to end of length
|
|
749
|
-
* @returns {
|
|
807
|
+
* @returns {DataType} Selected data as ``Uint8Array`` or ``Buffer``
|
|
750
808
|
*/
|
|
751
|
-
wrap(length: number, consume?: boolean):
|
|
809
|
+
wrap(length: number, consume?: boolean): DataType;
|
|
752
810
|
/**
|
|
753
811
|
* Inserts data into data.
|
|
754
812
|
*
|
|
755
813
|
* Note: Errors on strict mode.
|
|
756
814
|
*
|
|
757
|
-
* @param {
|
|
815
|
+
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
758
816
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
759
817
|
* @param {number} offset - Byte position to add at (defaults to current position)
|
|
760
818
|
*/
|
|
761
|
-
insert(data:
|
|
819
|
+
insert(data: DataType, consume?: boolean, offset?: number): void;
|
|
762
820
|
/**
|
|
763
821
|
* Inserts data into data.
|
|
764
822
|
*
|
|
765
823
|
* Note: Errors on strict mode.
|
|
766
824
|
*
|
|
767
|
-
* @param {
|
|
825
|
+
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
768
826
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
769
827
|
* @param {number} offset - Byte position to add at (defaults to current position)
|
|
770
828
|
*/
|
|
771
|
-
place(data:
|
|
829
|
+
place(data: DataType, consume?: boolean, offset?: number): void;
|
|
772
830
|
/**
|
|
773
831
|
* Adds data to start of supplied data.
|
|
774
832
|
*
|
|
775
833
|
* Note: Errors on strict mode.
|
|
776
834
|
*
|
|
777
|
-
* @param {
|
|
835
|
+
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
778
836
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
779
837
|
*/
|
|
780
|
-
unshift(data:
|
|
838
|
+
unshift(data: DataType, consume?: boolean): void;
|
|
781
839
|
/**
|
|
782
840
|
* Adds data to start of supplied data.
|
|
783
841
|
*
|
|
784
842
|
* Note: Errors on strict mode.
|
|
785
843
|
*
|
|
786
|
-
* @param {
|
|
844
|
+
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
787
845
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
788
846
|
*/
|
|
789
|
-
prepend(data:
|
|
847
|
+
prepend(data: DataType, consume?: boolean): void;
|
|
790
848
|
/**
|
|
791
849
|
* Adds data to end of supplied data.
|
|
792
850
|
*
|
|
793
851
|
* Note: Errors on strict mode.
|
|
794
852
|
*
|
|
795
|
-
* @param {
|
|
853
|
+
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
796
854
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
797
855
|
*/
|
|
798
|
-
push(data:
|
|
856
|
+
push(data: DataType, consume?: boolean): void;
|
|
799
857
|
/**
|
|
800
858
|
* Adds data to end of supplied data.
|
|
801
859
|
*
|
|
802
860
|
* Note: Errors on strict mode.
|
|
803
861
|
*
|
|
804
|
-
* @param {
|
|
862
|
+
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
805
863
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
806
864
|
*/
|
|
807
|
-
append(data:
|
|
865
|
+
append(data: DataType, consume?: boolean): void;
|
|
808
866
|
/**
|
|
809
867
|
* XOR data.
|
|
810
868
|
*
|
|
@@ -842,37 +900,37 @@ declare class BiBase {
|
|
|
842
900
|
/**
|
|
843
901
|
* AND data.
|
|
844
902
|
*
|
|
845
|
-
* @param {number|string|
|
|
903
|
+
* @param {number|string|Uint8Array|Buffer} andKey - Value, string or array to AND
|
|
846
904
|
* @param {number} startOffset - Start location (default current byte position)
|
|
847
905
|
* @param {number} endOffset - End location (default end of data)
|
|
848
906
|
* @param {boolean} consume - Move current position to end of data (default false)
|
|
849
907
|
*/
|
|
850
|
-
and(andKey: number | string |
|
|
908
|
+
and(andKey: number | string | Uint8Array | Buffer, startOffset?: number, endOffset?: number, consume?: boolean): void;
|
|
851
909
|
/**
|
|
852
910
|
* AND data.
|
|
853
911
|
*
|
|
854
|
-
* @param {number|string|
|
|
912
|
+
* @param {number|string|Uint8Array|Buffer} andKey - Value, string or array to AND
|
|
855
913
|
* @param {number} length - Length in bytes to AND from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
|
|
856
914
|
* @param {boolean} consume - Move current position to end of data (default false)
|
|
857
915
|
*/
|
|
858
|
-
andThis(andKey: number | string |
|
|
916
|
+
andThis(andKey: number | string | Uint8Array | Buffer, length?: number, consume?: boolean): void;
|
|
859
917
|
/**
|
|
860
918
|
* Add value to data.
|
|
861
919
|
*
|
|
862
|
-
* @param {number|string|
|
|
920
|
+
* @param {number|string|Uint8Array|Buffer} addKey - Value, string or array to add to data
|
|
863
921
|
* @param {number} startOffset - Start location (default current byte position)
|
|
864
922
|
* @param {number} endOffset - End location (default end of data)
|
|
865
923
|
* @param {boolean} consume - Move current position to end of data (default false)
|
|
866
924
|
*/
|
|
867
|
-
add(addKey: number | string |
|
|
925
|
+
add(addKey: number | string | Uint8Array | Buffer, startOffset?: number, endOffset?: number, consume?: boolean): void;
|
|
868
926
|
/**
|
|
869
927
|
* Add value to data.
|
|
870
928
|
*
|
|
871
|
-
* @param {number|string|
|
|
929
|
+
* @param {number|string|Uint8Array|Buffer} addKey - Value, string or array to add to data
|
|
872
930
|
* @param {number} length - Length in bytes to add from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
|
|
873
931
|
* @param {boolean} consume - Move current position to end of data (default false)
|
|
874
932
|
*/
|
|
875
|
-
addThis(addKey: number | string |
|
|
933
|
+
addThis(addKey: number | string | Uint8Array | Buffer, length?: number, consume?: boolean): void;
|
|
876
934
|
/**
|
|
877
935
|
* Not data.
|
|
878
936
|
*
|
|
@@ -891,37 +949,37 @@ declare class BiBase {
|
|
|
891
949
|
/**
|
|
892
950
|
* Left shift data.
|
|
893
951
|
*
|
|
894
|
-
* @param {number|string|
|
|
952
|
+
* @param {number|string|Uint8Array|Buffer} shiftKey - Value, string or array to left shift data
|
|
895
953
|
* @param {number} startOffset - Start location (default current byte position)
|
|
896
954
|
* @param {number} endOffset - End location (default end of data)
|
|
897
955
|
* @param {boolean} consume - Move current position to end of data (default false)
|
|
898
956
|
*/
|
|
899
|
-
lShift(shiftKey: number | string |
|
|
957
|
+
lShift(shiftKey: number | string | Uint8Array | Buffer, startOffset?: number, endOffset?: number, consume?: boolean): void;
|
|
900
958
|
/**
|
|
901
959
|
* Left shift data.
|
|
902
960
|
*
|
|
903
|
-
* @param {number|string|
|
|
961
|
+
* @param {number|string|Uint8Array|Buffer} shiftKey - Value, string or array to left shift data
|
|
904
962
|
* @param {number} length - Length in bytes to left shift from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
|
|
905
963
|
* @param {boolean} consume - Move current position to end of data (default false)
|
|
906
964
|
*/
|
|
907
|
-
lShiftThis(shiftKey: number | string |
|
|
965
|
+
lShiftThis(shiftKey: number | string | Uint8Array | Buffer, length?: number, consume?: boolean): void;
|
|
908
966
|
/**
|
|
909
967
|
* Right shift data.
|
|
910
968
|
*
|
|
911
|
-
* @param {number|string|
|
|
969
|
+
* @param {number|string|Uint8Array|Buffer} shiftKey - Value, string or array to right shift data
|
|
912
970
|
* @param {number} startOffset - Start location (default current byte position)
|
|
913
971
|
* @param {number} endOffset - End location (default end of data)
|
|
914
972
|
* @param {boolean} consume - Move current position to end of data (default false)
|
|
915
973
|
*/
|
|
916
|
-
rShift(shiftKey: number | string |
|
|
974
|
+
rShift(shiftKey: number | string | Uint8Array | Buffer, startOffset?: number, endOffset?: number, consume?: boolean): void;
|
|
917
975
|
/**
|
|
918
976
|
* Right shift data.
|
|
919
977
|
*
|
|
920
|
-
* @param {number|string|
|
|
978
|
+
* @param {number|string|Uint8Array|Buffer} shiftKey - Value, string or array to right shift data
|
|
921
979
|
* @param {number} length - Length in bytes to right shift from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
|
|
922
980
|
* @param {boolean} consume - Move current position to end of data (default false)
|
|
923
981
|
*/
|
|
924
|
-
rShiftThis(shiftKey: number | string |
|
|
982
|
+
rShiftThis(shiftKey: number | string | Uint8Array | Buffer, length?: number, consume?: boolean): void;
|
|
925
983
|
/**
|
|
926
984
|
*
|
|
927
985
|
* Write bits, must have at least value and number of bits.
|
|
@@ -1293,9 +1351,8 @@ declare class BiBase {
|
|
|
1293
1351
|
*
|
|
1294
1352
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
1295
1353
|
* @param {endian?} endian - ``big`` or ``little``
|
|
1296
|
-
* @returns {BigValue}
|
|
1297
1354
|
*/
|
|
1298
|
-
readInt64(unsigned?: boolean, endian?: endian):
|
|
1355
|
+
readInt64(unsigned?: boolean, endian?: endian): hasBigInt extends true ? bigint : number;
|
|
1299
1356
|
/**
|
|
1300
1357
|
* Write 64 bit integer.
|
|
1301
1358
|
*
|
|
@@ -1342,7 +1399,7 @@ declare class BiBase {
|
|
|
1342
1399
|
*
|
|
1343
1400
|
* @returns {BigValue}
|
|
1344
1401
|
*/
|
|
1345
|
-
readUInt64():
|
|
1402
|
+
readUInt64(): hasBigInt extends true ? bigint : number;
|
|
1346
1403
|
/**
|
|
1347
1404
|
* Read signed 64 bit integer.
|
|
1348
1405
|
*
|
|
@@ -1350,7 +1407,7 @@ declare class BiBase {
|
|
|
1350
1407
|
*
|
|
1351
1408
|
* @returns {BigValue}
|
|
1352
1409
|
*/
|
|
1353
|
-
readInt64BE():
|
|
1410
|
+
readInt64BE(): hasBigInt extends true ? bigint : number;
|
|
1354
1411
|
/**
|
|
1355
1412
|
* Read unsigned 64 bit integer.
|
|
1356
1413
|
*
|
|
@@ -1358,7 +1415,7 @@ declare class BiBase {
|
|
|
1358
1415
|
*
|
|
1359
1416
|
* @returns {BigValue}
|
|
1360
1417
|
*/
|
|
1361
|
-
readUInt64BE():
|
|
1418
|
+
readUInt64BE(): hasBigInt extends true ? bigint : number;
|
|
1362
1419
|
/**
|
|
1363
1420
|
* Read signed 64 bit integer.
|
|
1364
1421
|
*
|
|
@@ -1366,7 +1423,7 @@ declare class BiBase {
|
|
|
1366
1423
|
*
|
|
1367
1424
|
* @returns {BigValue}
|
|
1368
1425
|
*/
|
|
1369
|
-
readInt64LE():
|
|
1426
|
+
readInt64LE(): hasBigInt extends true ? bigint : number;
|
|
1370
1427
|
/**
|
|
1371
1428
|
* Read unsigned 64 bit integer.
|
|
1372
1429
|
*
|
|
@@ -1374,7 +1431,7 @@ declare class BiBase {
|
|
|
1374
1431
|
*
|
|
1375
1432
|
* @returns {BigValue}
|
|
1376
1433
|
*/
|
|
1377
|
-
readUInt64LE():
|
|
1434
|
+
readUInt64LE(): hasBigInt extends true ? bigint : number;
|
|
1378
1435
|
/**
|
|
1379
1436
|
* Read double float.
|
|
1380
1437
|
*
|
|
@@ -1423,7 +1480,7 @@ declare class BiBase {
|
|
|
1423
1480
|
* @param {stringOptions["lengthReadSize"]?} options.lengthReadSize - for pascal strings. 1, 2 or 4 byte length read size
|
|
1424
1481
|
* @param {stringOptions["encoding"]?} options.encoding - TextEncoder accepted types
|
|
1425
1482
|
* @param {stringOptions["endian"]?} options.endian - for wide-pascal and utf-16
|
|
1426
|
-
* @
|
|
1483
|
+
* @returns {string}
|
|
1427
1484
|
*/
|
|
1428
1485
|
readString(options?: stringOptions): string;
|
|
1429
1486
|
/**
|
|
@@ -1444,7 +1501,7 @@ declare class BiBase {
|
|
|
1444
1501
|
/**
|
|
1445
1502
|
* Binary reader, includes bitfields and strings.
|
|
1446
1503
|
*
|
|
1447
|
-
* @param {Buffer|Uint8Array}
|
|
1504
|
+
* @param {string|Buffer|Uint8Array} input - File path or a ``Buffer`` or ``Uint8Array``. Always found in ``BiReader.data``
|
|
1448
1505
|
* @param {BiOptions?} options - Any options to set at start
|
|
1449
1506
|
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start writer (default ``0``)
|
|
1450
1507
|
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset 0-7 to start writer (default ``0``)
|
|
@@ -1452,14 +1509,15 @@ declare class BiBase {
|
|
|
1452
1509
|
* @param {BiOptions["strict"]?} options.strict - Strict mode: if ``true`` does not extend supplied array on outside write (default ``false``)
|
|
1453
1510
|
* @param {BiOptions["extendBufferSize"]?} options.extendBufferSize - Amount of data to add when extending the buffer array when strict mode is false. Note: Changes logic in ``.get`` and ``.return``.
|
|
1454
1511
|
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always stay ``BigInt``.
|
|
1512
|
+
* @param {BiOptions["writeable"]} options.writeable - Allow data writes when reading a file (default false in reader)
|
|
1455
1513
|
*
|
|
1456
1514
|
* @since 2.0
|
|
1457
1515
|
*/
|
|
1458
|
-
declare class BiReader extends BiBase {
|
|
1516
|
+
declare class BiReader<DataType extends Buffer | Uint8Array, hasBigInt extends boolean> extends BiBase<DataType, hasBigInt> {
|
|
1459
1517
|
/**
|
|
1460
1518
|
* Binary reader, includes bitfields and strings.
|
|
1461
1519
|
*
|
|
1462
|
-
* @param {Buffer|Uint8Array}
|
|
1520
|
+
* @param {string|Buffer|Uint8Array} input - File path or a ``Buffer`` or ``Uint8Array``. Always found in ``BiReader.data``
|
|
1463
1521
|
* @param {BiOptions?} options - Any options to set at start
|
|
1464
1522
|
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start writer (default ``0``)
|
|
1465
1523
|
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset 0-7 to start writer (default ``0``)
|
|
@@ -1467,8 +1525,9 @@ declare class BiReader extends BiBase {
|
|
|
1467
1525
|
* @param {BiOptions["strict"]?} options.strict - Strict mode: if ``true`` does not extend supplied array on outside write (default ``false``)
|
|
1468
1526
|
* @param {BiOptions["extendBufferSize"]?} options.extendBufferSize - Amount of data to add when extending the buffer array when strict mode is false. Note: Changes logic in ``.get`` and ``.return``.
|
|
1469
1527
|
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always stay ``BigInt``.
|
|
1528
|
+
* @param {BiOptions["writeable"]} options.writeable - Allow data writes when reading a file (default false in reader)
|
|
1470
1529
|
*/
|
|
1471
|
-
constructor(
|
|
1530
|
+
constructor(input: string | DataType, options?: BiOptions);
|
|
1472
1531
|
/**
|
|
1473
1532
|
* Bit field reader.
|
|
1474
1533
|
*
|
|
@@ -3398,146 +3457,110 @@ declare class BiReader extends BiBase {
|
|
|
3398
3457
|
* Read signed 64 bit integer
|
|
3399
3458
|
*
|
|
3400
3459
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3401
|
-
*
|
|
3402
|
-
* @returns {BigValue}
|
|
3403
3460
|
*/
|
|
3404
|
-
get int64():
|
|
3461
|
+
get int64(): hasBigInt extends true ? bigint : number;
|
|
3405
3462
|
/**
|
|
3406
3463
|
* Read signed 64 bit integer.
|
|
3407
3464
|
*
|
|
3408
3465
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3409
|
-
*
|
|
3410
|
-
* @returns {BigValue}
|
|
3411
3466
|
*/
|
|
3412
|
-
get bigint():
|
|
3467
|
+
get bigint(): hasBigInt extends true ? bigint : number;
|
|
3413
3468
|
/**
|
|
3414
3469
|
* Read signed 64 bit integer.
|
|
3415
3470
|
*
|
|
3416
3471
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3417
|
-
*
|
|
3418
|
-
* @returns {BigValue}
|
|
3419
3472
|
*/
|
|
3420
|
-
get quad():
|
|
3473
|
+
get quad(): hasBigInt extends true ? bigint : number;
|
|
3421
3474
|
/**
|
|
3422
3475
|
* Read unsigned 64 bit integer.
|
|
3423
3476
|
*
|
|
3424
3477
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3425
|
-
*
|
|
3426
|
-
* @returns {BigValue}
|
|
3427
3478
|
*/
|
|
3428
|
-
get uint64():
|
|
3479
|
+
get uint64(): hasBigInt extends true ? bigint : number;
|
|
3429
3480
|
/**
|
|
3430
3481
|
* Read unsigned 64 bit integer.
|
|
3431
3482
|
*
|
|
3432
3483
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3433
|
-
*
|
|
3434
|
-
* @returns {BigValue}
|
|
3435
3484
|
*/
|
|
3436
|
-
get ubigint():
|
|
3485
|
+
get ubigint(): hasBigInt extends true ? bigint : number;
|
|
3437
3486
|
/**
|
|
3438
3487
|
* Read unsigned 64 bit integer.
|
|
3439
3488
|
*
|
|
3440
3489
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3441
|
-
*
|
|
3442
|
-
* @returns {BigValue}
|
|
3443
3490
|
*/
|
|
3444
|
-
get uquad():
|
|
3491
|
+
get uquad(): hasBigInt extends true ? bigint : number;
|
|
3445
3492
|
/**
|
|
3446
3493
|
* Read signed 64 bit integer.
|
|
3447
3494
|
*
|
|
3448
3495
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3449
|
-
*
|
|
3450
|
-
* @returns {BigValue}
|
|
3451
3496
|
*/
|
|
3452
|
-
get int64be():
|
|
3497
|
+
get int64be(): hasBigInt extends true ? bigint : number;
|
|
3453
3498
|
/**
|
|
3454
3499
|
* Read signed 64 bit integer.
|
|
3455
3500
|
*
|
|
3456
3501
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3457
|
-
*
|
|
3458
|
-
* @returns {BigValue}
|
|
3459
3502
|
*/
|
|
3460
|
-
get bigintbe():
|
|
3503
|
+
get bigintbe(): hasBigInt extends true ? bigint : number;
|
|
3461
3504
|
/**
|
|
3462
3505
|
* Read signed 64 bit integer.
|
|
3463
3506
|
*
|
|
3464
3507
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3465
|
-
*
|
|
3466
|
-
* @returns {BigValue}
|
|
3467
3508
|
*/
|
|
3468
|
-
get quadbe():
|
|
3509
|
+
get quadbe(): hasBigInt extends true ? bigint : number;
|
|
3469
3510
|
/**
|
|
3470
3511
|
* Read unsigned 64 bit integer.
|
|
3471
3512
|
*
|
|
3472
3513
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3473
|
-
*
|
|
3474
|
-
* @returns {BigValue}
|
|
3475
3514
|
*/
|
|
3476
|
-
get uint64be():
|
|
3515
|
+
get uint64be(): hasBigInt extends true ? bigint : number;
|
|
3477
3516
|
/**
|
|
3478
3517
|
* Read unsigned 64 bit integer.
|
|
3479
3518
|
*
|
|
3480
3519
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3481
|
-
*
|
|
3482
|
-
* @returns {BigValue}
|
|
3483
3520
|
*/
|
|
3484
|
-
get ubigintbe():
|
|
3521
|
+
get ubigintbe(): hasBigInt extends true ? bigint : number;
|
|
3485
3522
|
/**
|
|
3486
3523
|
* Read unsigned 64 bit integer.
|
|
3487
3524
|
*
|
|
3488
3525
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3489
|
-
*
|
|
3490
|
-
* @returns {BigValue}
|
|
3491
3526
|
*/
|
|
3492
|
-
get uquadbe():
|
|
3527
|
+
get uquadbe(): hasBigInt extends true ? bigint : number;
|
|
3493
3528
|
/**
|
|
3494
3529
|
* Read signed 64 bit integer.
|
|
3495
3530
|
*
|
|
3496
3531
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3497
|
-
*
|
|
3498
|
-
* @returns {BigValue}
|
|
3499
3532
|
*/
|
|
3500
|
-
get int64le():
|
|
3533
|
+
get int64le(): hasBigInt extends true ? bigint : number;
|
|
3501
3534
|
/**
|
|
3502
3535
|
* Read signed 64 bit integer.
|
|
3503
3536
|
*
|
|
3504
3537
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3505
|
-
*
|
|
3506
|
-
* @returns {BigValue}
|
|
3507
3538
|
*/
|
|
3508
|
-
get bigintle():
|
|
3539
|
+
get bigintle(): hasBigInt extends true ? bigint : number;
|
|
3509
3540
|
/**
|
|
3510
3541
|
* Read signed 64 bit integer.
|
|
3511
3542
|
*
|
|
3512
3543
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3513
|
-
*
|
|
3514
|
-
* @returns {BigValue}
|
|
3515
3544
|
*/
|
|
3516
|
-
get quadle():
|
|
3545
|
+
get quadle(): hasBigInt extends true ? bigint : number;
|
|
3517
3546
|
/**
|
|
3518
3547
|
* Read unsigned 64 bit integer.
|
|
3519
3548
|
*
|
|
3520
3549
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3521
|
-
*
|
|
3522
|
-
* @returns {BigValue}
|
|
3523
3550
|
*/
|
|
3524
|
-
get uint64le():
|
|
3551
|
+
get uint64le(): hasBigInt extends true ? bigint : number;
|
|
3525
3552
|
/**
|
|
3526
3553
|
* Read unsigned 64 bit integer.
|
|
3527
3554
|
*
|
|
3528
3555
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3529
|
-
*
|
|
3530
|
-
* @returns {BigValue}
|
|
3531
3556
|
*/
|
|
3532
|
-
get ubigintle():
|
|
3557
|
+
get ubigintle(): hasBigInt extends true ? bigint : number;
|
|
3533
3558
|
/**
|
|
3534
3559
|
* Read unsigned 64 bit integer.
|
|
3535
3560
|
*
|
|
3536
3561
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3537
|
-
*
|
|
3538
|
-
* @returns {BigValue}
|
|
3539
3562
|
*/
|
|
3540
|
-
get uquadle():
|
|
3563
|
+
get uquadle(): hasBigInt extends true ? bigint : number;
|
|
3541
3564
|
/**
|
|
3542
3565
|
* Read double float.
|
|
3543
3566
|
*
|
|
@@ -3585,7 +3608,7 @@ declare class BiReader extends BiBase {
|
|
|
3585
3608
|
* @param {stringOptions["stripNull"]?} options.stripNull - removes 0x00 characters
|
|
3586
3609
|
* @param {stringOptions["encoding"]?} options.encoding - TextEncoder accepted types
|
|
3587
3610
|
* @param {stringOptions["endian"]?} options.endian - for wide-pascal and utf-16
|
|
3588
|
-
* @
|
|
3611
|
+
* @returns {string}
|
|
3589
3612
|
*/
|
|
3590
3613
|
string(options?: stringOptions): string;
|
|
3591
3614
|
/**
|
|
@@ -3593,7 +3616,7 @@ declare class BiReader extends BiBase {
|
|
|
3593
3616
|
*
|
|
3594
3617
|
* Default is ``utf-8``
|
|
3595
3618
|
*
|
|
3596
|
-
* @
|
|
3619
|
+
* @returns {string}
|
|
3597
3620
|
*/
|
|
3598
3621
|
get str(): string;
|
|
3599
3622
|
/**
|
|
@@ -3603,7 +3626,7 @@ declare class BiReader extends BiBase {
|
|
|
3603
3626
|
* @param {stringOptions["terminateValue"]} terminateValue - for non-fixed length utf strings
|
|
3604
3627
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3605
3628
|
*
|
|
3606
|
-
* @
|
|
3629
|
+
* @returns {string}
|
|
3607
3630
|
*/
|
|
3608
3631
|
utf8string(length?: stringOptions["length"], terminateValue?: stringOptions["terminateValue"], stripNull?: stringOptions["stripNull"]): string;
|
|
3609
3632
|
/**
|
|
@@ -3613,7 +3636,7 @@ declare class BiReader extends BiBase {
|
|
|
3613
3636
|
* @param {stringOptions["terminateValue"]} terminateValue - for non-fixed length utf strings
|
|
3614
3637
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3615
3638
|
*
|
|
3616
|
-
* @
|
|
3639
|
+
* @returns {string}
|
|
3617
3640
|
*/
|
|
3618
3641
|
cstring(length?: stringOptions["length"], terminateValue?: stringOptions["terminateValue"], stripNull?: stringOptions["stripNull"]): string;
|
|
3619
3642
|
/**
|
|
@@ -3623,7 +3646,7 @@ declare class BiReader extends BiBase {
|
|
|
3623
3646
|
* @param {stringOptions["terminateValue"]} terminateValue - for non-fixed length utf strings
|
|
3624
3647
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3625
3648
|
*
|
|
3626
|
-
* @
|
|
3649
|
+
* @returns {string}
|
|
3627
3650
|
*/
|
|
3628
3651
|
ansistring(length?: stringOptions["length"], terminateValue?: stringOptions["terminateValue"], stripNull?: stringOptions["stripNull"]): string;
|
|
3629
3652
|
/**
|
|
@@ -3634,7 +3657,7 @@ declare class BiReader extends BiBase {
|
|
|
3634
3657
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3635
3658
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3636
3659
|
*
|
|
3637
|
-
* @
|
|
3660
|
+
* @returns {string}
|
|
3638
3661
|
*/
|
|
3639
3662
|
utf16string(length?: stringOptions["length"], terminateValue?: stringOptions["terminateValue"], stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3640
3663
|
/**
|
|
@@ -3645,7 +3668,7 @@ declare class BiReader extends BiBase {
|
|
|
3645
3668
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3646
3669
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3647
3670
|
*
|
|
3648
|
-
* @
|
|
3671
|
+
* @returns {string}
|
|
3649
3672
|
*/
|
|
3650
3673
|
unistring(length?: stringOptions["length"], terminateValue?: stringOptions["terminateValue"], stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3651
3674
|
/**
|
|
@@ -3655,7 +3678,7 @@ declare class BiReader extends BiBase {
|
|
|
3655
3678
|
* @param {stringOptions["terminateValue"]} terminateValue - for non-fixed length utf strings
|
|
3656
3679
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3657
3680
|
*
|
|
3658
|
-
* @
|
|
3681
|
+
* @returns {string}
|
|
3659
3682
|
*/
|
|
3660
3683
|
utf16stringle(length?: stringOptions["length"], terminateValue?: stringOptions["terminateValue"], stripNull?: stringOptions["stripNull"]): string;
|
|
3661
3684
|
/**
|
|
@@ -3665,7 +3688,7 @@ declare class BiReader extends BiBase {
|
|
|
3665
3688
|
* @param {stringOptions["terminateValue"]} terminateValue - for non-fixed length utf strings
|
|
3666
3689
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3667
3690
|
*
|
|
3668
|
-
* @
|
|
3691
|
+
* @returns {string}
|
|
3669
3692
|
*/
|
|
3670
3693
|
unistringle(length?: stringOptions["length"], terminateValue?: stringOptions["terminateValue"], stripNull?: stringOptions["stripNull"]): string;
|
|
3671
3694
|
/**
|
|
@@ -3675,7 +3698,7 @@ declare class BiReader extends BiBase {
|
|
|
3675
3698
|
* @param {stringOptions["terminateValue"]} terminateValue - for non-fixed length utf strings
|
|
3676
3699
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3677
3700
|
*
|
|
3678
|
-
* @
|
|
3701
|
+
* @returns {string}
|
|
3679
3702
|
*/
|
|
3680
3703
|
utf16stringbe(length?: stringOptions["length"], terminateValue?: stringOptions["terminateValue"], stripNull?: stringOptions["stripNull"]): string;
|
|
3681
3704
|
/**
|
|
@@ -3685,7 +3708,7 @@ declare class BiReader extends BiBase {
|
|
|
3685
3708
|
* @param {stringOptions["terminateValue"]} terminateValue - for non-fixed length utf strings
|
|
3686
3709
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3687
3710
|
*
|
|
3688
|
-
* @
|
|
3711
|
+
* @returns {string}
|
|
3689
3712
|
*/
|
|
3690
3713
|
unistringbe(length?: stringOptions["length"], terminateValue?: stringOptions["terminateValue"], stripNull?: stringOptions["stripNull"]): string;
|
|
3691
3714
|
/**
|
|
@@ -3695,7 +3718,7 @@ declare class BiReader extends BiBase {
|
|
|
3695
3718
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3696
3719
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3697
3720
|
*
|
|
3698
|
-
* @
|
|
3721
|
+
* @returns {string}
|
|
3699
3722
|
*/
|
|
3700
3723
|
pstring(lengthReadSize?: stringOptions["lengthReadSize"], stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3701
3724
|
/**
|
|
@@ -3704,7 +3727,7 @@ declare class BiReader extends BiBase {
|
|
|
3704
3727
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3705
3728
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3706
3729
|
*
|
|
3707
|
-
* @
|
|
3730
|
+
* @returns {string}
|
|
3708
3731
|
*/
|
|
3709
3732
|
pstring1(stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3710
3733
|
/**
|
|
@@ -3712,7 +3735,7 @@ declare class BiReader extends BiBase {
|
|
|
3712
3735
|
*
|
|
3713
3736
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3714
3737
|
*
|
|
3715
|
-
* @
|
|
3738
|
+
* @returns {string}
|
|
3716
3739
|
*/
|
|
3717
3740
|
pstring1le(stripNull?: stringOptions["stripNull"]): string;
|
|
3718
3741
|
/**
|
|
@@ -3720,7 +3743,7 @@ declare class BiReader extends BiBase {
|
|
|
3720
3743
|
*
|
|
3721
3744
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3722
3745
|
*
|
|
3723
|
-
* @
|
|
3746
|
+
* @returns {string}
|
|
3724
3747
|
*/
|
|
3725
3748
|
pstring1be(stripNull?: stringOptions["stripNull"]): string;
|
|
3726
3749
|
/**
|
|
@@ -3729,7 +3752,7 @@ declare class BiReader extends BiBase {
|
|
|
3729
3752
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3730
3753
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3731
3754
|
*
|
|
3732
|
-
* @
|
|
3755
|
+
* @returns {string}
|
|
3733
3756
|
*/
|
|
3734
3757
|
pstring2(stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3735
3758
|
/**
|
|
@@ -3737,7 +3760,7 @@ declare class BiReader extends BiBase {
|
|
|
3737
3760
|
*
|
|
3738
3761
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3739
3762
|
*
|
|
3740
|
-
* @
|
|
3763
|
+
* @returns {string}
|
|
3741
3764
|
*/
|
|
3742
3765
|
pstring2le(stripNull?: stringOptions["stripNull"]): string;
|
|
3743
3766
|
/**
|
|
@@ -3745,7 +3768,7 @@ declare class BiReader extends BiBase {
|
|
|
3745
3768
|
*
|
|
3746
3769
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3747
3770
|
*
|
|
3748
|
-
* @
|
|
3771
|
+
* @returns {string}
|
|
3749
3772
|
*/
|
|
3750
3773
|
pstring2be(stripNull?: stringOptions["stripNull"]): string;
|
|
3751
3774
|
/**
|
|
@@ -3754,7 +3777,7 @@ declare class BiReader extends BiBase {
|
|
|
3754
3777
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3755
3778
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3756
3779
|
*
|
|
3757
|
-
* @
|
|
3780
|
+
* @returns {string}
|
|
3758
3781
|
*/
|
|
3759
3782
|
pstring4(stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3760
3783
|
/**
|
|
@@ -3762,7 +3785,7 @@ declare class BiReader extends BiBase {
|
|
|
3762
3785
|
*
|
|
3763
3786
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3764
3787
|
*
|
|
3765
|
-
* @
|
|
3788
|
+
* @returns {string}
|
|
3766
3789
|
*/
|
|
3767
3790
|
pstring4le(stripNull?: stringOptions["stripNull"]): string;
|
|
3768
3791
|
/**
|
|
@@ -3770,7 +3793,7 @@ declare class BiReader extends BiBase {
|
|
|
3770
3793
|
*
|
|
3771
3794
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3772
3795
|
*
|
|
3773
|
-
* @
|
|
3796
|
+
* @returns {string}
|
|
3774
3797
|
*/
|
|
3775
3798
|
pstring4be(stripNull?: stringOptions["stripNull"]): string;
|
|
3776
3799
|
/**
|
|
@@ -3780,7 +3803,7 @@ declare class BiReader extends BiBase {
|
|
|
3780
3803
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3781
3804
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3782
3805
|
*
|
|
3783
|
-
* @
|
|
3806
|
+
* @returns {string}
|
|
3784
3807
|
*/
|
|
3785
3808
|
wpstring(lengthReadSize?: stringOptions["lengthReadSize"], stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3786
3809
|
/**
|
|
@@ -3789,16 +3812,32 @@ declare class BiReader extends BiBase {
|
|
|
3789
3812
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3790
3813
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3791
3814
|
*
|
|
3792
|
-
* @
|
|
3815
|
+
* @returns {string}
|
|
3793
3816
|
*/
|
|
3794
3817
|
wpstring1(stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3795
3818
|
/**
|
|
3819
|
+
* Reads Wide-Pascal string 1 byte length read in little endian order.
|
|
3820
|
+
*
|
|
3821
|
+
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3822
|
+
*
|
|
3823
|
+
* @returns {string}
|
|
3824
|
+
*/
|
|
3825
|
+
wpstring1le(stripNull?: stringOptions["stripNull"]): string;
|
|
3826
|
+
/**
|
|
3827
|
+
* Reads Wide-Pascal string 1 byte length read in big endian order.
|
|
3828
|
+
*
|
|
3829
|
+
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3830
|
+
*
|
|
3831
|
+
* @returns {string}
|
|
3832
|
+
*/
|
|
3833
|
+
wpstring1be(stripNull?: stringOptions["stripNull"]): string;
|
|
3834
|
+
/**
|
|
3796
3835
|
* Reads Wide-Pascal string 2 byte length read.
|
|
3797
3836
|
*
|
|
3798
3837
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3799
3838
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3800
3839
|
*
|
|
3801
|
-
* @
|
|
3840
|
+
* @returns {string}
|
|
3802
3841
|
*/
|
|
3803
3842
|
wpstring2(stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3804
3843
|
/**
|
|
@@ -3806,7 +3845,7 @@ declare class BiReader extends BiBase {
|
|
|
3806
3845
|
*
|
|
3807
3846
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3808
3847
|
*
|
|
3809
|
-
* @
|
|
3848
|
+
* @returns {string}
|
|
3810
3849
|
*/
|
|
3811
3850
|
wpstring2le(stripNull?: stringOptions["stripNull"]): string;
|
|
3812
3851
|
/**
|
|
@@ -3814,7 +3853,7 @@ declare class BiReader extends BiBase {
|
|
|
3814
3853
|
*
|
|
3815
3854
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3816
3855
|
*
|
|
3817
|
-
* @
|
|
3856
|
+
* @returns {string}
|
|
3818
3857
|
*/
|
|
3819
3858
|
wpstring2be(stripNull?: stringOptions["stripNull"]): string;
|
|
3820
3859
|
/**
|
|
@@ -3823,7 +3862,7 @@ declare class BiReader extends BiBase {
|
|
|
3823
3862
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3824
3863
|
* @param {stringOptions["endian"]} endian - ``big`` or ``little``
|
|
3825
3864
|
*
|
|
3826
|
-
* @
|
|
3865
|
+
* @returns {string}
|
|
3827
3866
|
*/
|
|
3828
3867
|
wpstring4(stripNull?: stringOptions["stripNull"], endian?: stringOptions["endian"]): string;
|
|
3829
3868
|
/**
|
|
@@ -3831,7 +3870,7 @@ declare class BiReader extends BiBase {
|
|
|
3831
3870
|
*
|
|
3832
3871
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3833
3872
|
*
|
|
3834
|
-
* @
|
|
3873
|
+
* @returns {string}
|
|
3835
3874
|
*/
|
|
3836
3875
|
wpstring4be(stripNull?: stringOptions["stripNull"]): string;
|
|
3837
3876
|
/**
|
|
@@ -3839,7 +3878,7 @@ declare class BiReader extends BiBase {
|
|
|
3839
3878
|
*
|
|
3840
3879
|
* @param {stringOptions["stripNull"]} stripNull - removes 0x00 characters
|
|
3841
3880
|
*
|
|
3842
|
-
* @
|
|
3881
|
+
* @returns {string}
|
|
3843
3882
|
*/
|
|
3844
3883
|
wpstring4le(stripNull?: stringOptions["stripNull"]): string;
|
|
3845
3884
|
}
|
|
@@ -3847,7 +3886,7 @@ declare class BiReader extends BiBase {
|
|
|
3847
3886
|
/**
|
|
3848
3887
|
* Binary writer, includes bitfields and strings.
|
|
3849
3888
|
*
|
|
3850
|
-
* @param {Buffer|Uint8Array}
|
|
3889
|
+
* @param {string|Buffer|Uint8Array} input - File path or a ``Buffer`` or ``Uint8Array``. Always found in ``BiWriter.data``
|
|
3851
3890
|
* @param {BiOptions?} options - Any options to set at start
|
|
3852
3891
|
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start writer (default ``0``)
|
|
3853
3892
|
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset 0-7 to start writer (default ``0``)
|
|
@@ -3855,14 +3894,15 @@ declare class BiReader extends BiBase {
|
|
|
3855
3894
|
* @param {BiOptions["strict"]?} options.strict - Strict mode: if ``true`` does not extend supplied array on outside write (default ``false``)
|
|
3856
3895
|
* @param {BiOptions["extendBufferSize"]?} options.extendBufferSize - Amount of data to add when extending the buffer array when strict mode is false. Note: Changes logic in ``.get`` and ``.return``.
|
|
3857
3896
|
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always stay ``BigInt``.
|
|
3897
|
+
* @param {BiOptions["writeable"]} options.writeable - Allow data writes when reading a file (default true in writer)
|
|
3858
3898
|
*
|
|
3859
3899
|
* @since 2.0
|
|
3860
3900
|
*/
|
|
3861
|
-
declare class BiWriter extends BiBase {
|
|
3901
|
+
declare class BiWriter<DataType extends Buffer | Uint8Array, hasBigInt extends boolean> extends BiBase<DataType, hasBigInt> {
|
|
3862
3902
|
/**
|
|
3863
3903
|
* Binary writer, includes bitfields and strings.
|
|
3864
3904
|
*
|
|
3865
|
-
* @param {Buffer|Uint8Array}
|
|
3905
|
+
* @param {string|Buffer|Uint8Array} input - ``Buffer`` or ``Uint8Array``. Always found in ``BiWriter.data``
|
|
3866
3906
|
* @param {BiOptions?} options - Any options to set at start
|
|
3867
3907
|
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start writer (default ``0``)
|
|
3868
3908
|
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset 0-7 to start writer (default ``0``)
|
|
@@ -3870,8 +3910,9 @@ declare class BiWriter extends BiBase {
|
|
|
3870
3910
|
* @param {BiOptions["strict"]?} options.strict - Strict mode: if ``true`` does not extend supplied array on outside write (default ``false``)
|
|
3871
3911
|
* @param {BiOptions["extendBufferSize"]?} options.extendBufferSize - Amount of data to add when extending the buffer array when strict mode is false. Note: Changes logic in ``.get`` and ``.return``.
|
|
3872
3912
|
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always stay ``BigInt``.
|
|
3913
|
+
* @param {BiOptions["writeable"]} options.writeable - Allow data writes when reading a file (default true in writer)
|
|
3873
3914
|
*/
|
|
3874
|
-
constructor(
|
|
3915
|
+
constructor(input?: string | DataType, options?: BiOptions);
|
|
3875
3916
|
/**
|
|
3876
3917
|
* Bit field writer.
|
|
3877
3918
|
*
|
|
@@ -6202,6 +6243,14 @@ declare class BiWriter extends BiBase {
|
|
|
6202
6243
|
declare class BiReaderStream {
|
|
6203
6244
|
constructor();
|
|
6204
6245
|
}
|
|
6246
|
+
/**
|
|
6247
|
+
* Isn't usable in browser.
|
|
6248
|
+
* @since 4.0
|
|
6249
|
+
* @deprecated Use ``BiReader`` instead.
|
|
6250
|
+
*/
|
|
6251
|
+
declare class BiFileReader {
|
|
6252
|
+
constructor();
|
|
6253
|
+
}
|
|
6205
6254
|
/**
|
|
6206
6255
|
* Isn't usable in browser.
|
|
6207
6256
|
* @since 3.0
|
|
@@ -6226,5 +6275,13 @@ declare class bireader {
|
|
|
6226
6275
|
declare class biwriter {
|
|
6227
6276
|
constructor();
|
|
6228
6277
|
}
|
|
6278
|
+
/**
|
|
6279
|
+
* Isn't usable in browser.
|
|
6280
|
+
* @since 4.0
|
|
6281
|
+
* @deprecated Use ``BiWriter`` instead.
|
|
6282
|
+
*/
|
|
6283
|
+
declare class BiFileWriter {
|
|
6284
|
+
constructor();
|
|
6285
|
+
}
|
|
6229
6286
|
|
|
6230
|
-
export { BiReader, BiReaderStream, BiWriter, BiWriterStream, bireader, biwriter, hexdump };
|
|
6287
|
+
export { BiBase, BiFileReader, BiFileWriter, BiReader, BiReaderStream, BiWriter, BiWriterStream, bireader, biwriter, hexdump };
|