bireader 3.0.1 → 3.1.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/README.md +91 -29
- package/dist/BiReader.d.ts +339 -0
- package/dist/BiReaderStream.d.ts +340 -0
- package/dist/BiWriter.d.ts +344 -0
- package/dist/BiWriterStream.d.ts +347 -0
- package/dist/aliases/BinaryAliasReader.d.ts +4678 -0
- package/dist/aliases/BinaryAliasWriter.d.ts +4648 -0
- package/dist/common.d.ts +90 -0
- package/{build/esm/common.d.ts → dist/core/BiBase.d.ts} +132 -221
- package/{build/cjs/common.d.ts → dist/core/BiBaseStream.d.ts} +197 -261
- package/dist/index.browser.d.ts +6738 -0
- package/dist/index.browser.js +11557 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.cjs.d.ts +13439 -0
- package/dist/index.cjs.js +17364 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +13439 -0
- package/dist/index.esm.d.ts +13439 -0
- package/dist/index.esm.js +17337 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/indexBrowser.d.ts +19 -0
- package/dist/indexImport.d.ts +21 -0
- package/package.json +23 -14
- package/rollup.config.js +76 -0
- package/tsconfig.json +15 -0
- package/build/cjs/bireader.d.ts +0 -2372
- package/build/cjs/bireader.d.ts.map +0 -1
- package/build/cjs/bireader.js +0 -3060
- package/build/cjs/bireader.js.map +0 -1
- package/build/cjs/biwriter.d.ts +0 -2359
- package/build/cjs/biwriter.d.ts.map +0 -1
- package/build/cjs/biwriter.js +0 -3094
- package/build/cjs/biwriter.js.map +0 -1
- package/build/cjs/common.d.ts.map +0 -1
- package/build/cjs/common.js +0 -3615
- package/build/cjs/common.js.map +0 -1
- package/build/cjs/index.d.ts +0 -18
- package/build/cjs/index.d.ts.map +0 -1
- package/build/cjs/index.js +0 -30
- package/build/cjs/index.js.map +0 -1
- package/build/esm/bireader.d.ts +0 -2372
- package/build/esm/bireader.d.ts.map +0 -1
- package/build/esm/bireader.js +0 -3060
- package/build/esm/bireader.js.map +0 -1
- package/build/esm/biwriter.d.ts +0 -2359
- package/build/esm/biwriter.d.ts.map +0 -1
- package/build/esm/biwriter.js +0 -3094
- package/build/esm/biwriter.js.map +0 -1
- package/build/esm/common.d.ts.map +0 -1
- package/build/esm/common.js +0 -3615
- package/build/esm/common.js.map +0 -1
- package/build/esm/index.d.ts +0 -18
- package/build/esm/index.d.ts.map +0 -1
- package/build/esm/index.js +0 -30
- package/build/esm/index.js.map +0 -1
|
@@ -1,123 +1,52 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare function
|
|
27
|
-
export declare function
|
|
28
|
-
export declare function
|
|
29
|
-
export declare function
|
|
30
|
-
export declare function
|
|
31
|
-
export declare function
|
|
32
|
-
export declare function
|
|
33
|
-
export declare function
|
|
34
|
-
export declare function
|
|
35
|
-
export declare function
|
|
36
|
-
export declare function
|
|
37
|
-
export declare function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*/
|
|
46
|
-
startByte?: number;
|
|
47
|
-
/**
|
|
48
|
-
* Supress unicode character preview for even columns.
|
|
49
|
-
*/
|
|
50
|
-
supressUnicode?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Returns the hex dump string instead of logging it.
|
|
53
|
-
*/
|
|
54
|
-
returnString?: boolean;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Creates hex dump string. Will console log or return string if set in options.
|
|
58
|
-
*
|
|
59
|
-
* @param {Uint8Array|Buffer} src - Uint8Array or Buffer
|
|
60
|
-
* @param {hexdumpOptions?} options - hex dump options
|
|
61
|
-
* @param {number?} options.length - number of bytes to log, default ``192`` or end of data
|
|
62
|
-
* @param {number?} options.startByte - byte to start dump (default ``0``)
|
|
63
|
-
* @param {boolean?} options.supressUnicode - Supress unicode character preview for even columns.
|
|
64
|
-
* @param {boolean?} options.returnString - Returns the hex dump string instead of logging it.
|
|
65
|
-
*/
|
|
66
|
-
export declare function hexdump(src: Uint8Array | Buffer, options?: hexdumpOptions): void | string;
|
|
67
|
-
export declare function hexDump(_this: BiReader | BiWriter | ReaderBase, options?: hexdumpOptions): void | string;
|
|
68
|
-
export declare function AND(_this: BiReader | BiWriter | ReaderBase, and_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
69
|
-
export declare function OR(_this: BiReader | BiWriter | ReaderBase, or_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
70
|
-
export declare function XOR(_this: BiReader | BiWriter | ReaderBase, xor_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
71
|
-
export declare function NOT(_this: BiReader | BiWriter | ReaderBase, start?: number, end?: number, consume?: boolean): any;
|
|
72
|
-
export declare function LSHIFT(_this: BiReader | BiWriter | ReaderBase, shift_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
73
|
-
export declare function RSHIFT(_this: BiReader | BiWriter | ReaderBase, shift_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
74
|
-
export declare function ADD(_this: BiReader | BiWriter | ReaderBase, add_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
75
|
-
export declare function fString(_this: BiReader | BiWriter | ReaderBase, searchString: string): number;
|
|
76
|
-
export declare function fNumber(_this: BiReader | BiWriter | ReaderBase, targetNumber: number, bits: number, unsigned: boolean, endian?: string): number;
|
|
77
|
-
export declare function fHalfFloat(_this: BiReader | BiWriter | ReaderBase, targetNumber: number, endian?: string): number;
|
|
78
|
-
export declare function fFloat(_this: BiReader | BiWriter | ReaderBase, targetNumber: number, endian?: string): number;
|
|
79
|
-
export declare function fBigInt(_this: BiReader | BiWriter | ReaderBase, targetNumber: number, unsigned: boolean, endian?: string): number;
|
|
80
|
-
export declare function fDoubleFloat(_this: BiReader | BiWriter | ReaderBase, targetNumber: number, endian?: string): number;
|
|
81
|
-
export declare function wbit(_this: BiReader | BiWriter | ReaderBase, value: number, bits: number, unsigned?: boolean, endian?: string): void;
|
|
82
|
-
export declare function rbit(_this: BiReader | BiWriter | ReaderBase, bits?: number, unsigned?: boolean, endian?: string): number;
|
|
83
|
-
export declare function wbyte(_this: BiReader | BiWriter | ReaderBase, value: number, unsigned?: boolean): void;
|
|
84
|
-
export declare function rbyte(_this: BiReader | BiWriter | ReaderBase, unsigned?: boolean): number;
|
|
85
|
-
export declare function wint16(_this: BiReader | BiWriter | ReaderBase, value: number, unsigned?: boolean, endian?: string): void;
|
|
86
|
-
export declare function rint16(_this: BiReader | BiWriter | ReaderBase, unsigned?: boolean, endian?: string): number;
|
|
87
|
-
export declare function rhalffloat(_this: BiReader | BiWriter | ReaderBase, endian?: string): number;
|
|
88
|
-
export declare function whalffloat(_this: BiReader | BiWriter | ReaderBase, value: number, endian?: string): void;
|
|
89
|
-
export declare function wint32(_this: BiReader | BiWriter | ReaderBase, value: number, unsigned?: boolean, endian?: string): void;
|
|
90
|
-
export declare function rint32(_this: BiReader | BiWriter | ReaderBase, unsigned?: boolean, endian?: string): number;
|
|
91
|
-
export declare function rfloat(_this: BiReader | BiWriter | ReaderBase, endian?: string): number;
|
|
92
|
-
export declare function wfloat(_this: BiReader | BiWriter | ReaderBase, value: number, endian?: string): void;
|
|
93
|
-
export declare function rint64(_this: BiReader | BiWriter | ReaderBase, unsigned?: boolean, endian?: string): bigint;
|
|
94
|
-
export declare function wint64(_this: BiReader | BiWriter | ReaderBase, value: number, unsigned?: boolean, endian?: string): void;
|
|
95
|
-
export declare function wdfloat(_this: BiReader | BiWriter | ReaderBase, value: number, endian?: string): void;
|
|
96
|
-
export declare function rdfloat(_this: BiReader | BiWriter | ReaderBase, endian?: string): number;
|
|
97
|
-
export declare function rstring(_this: BiReader | BiWriter | ReaderBase, options?: {
|
|
98
|
-
length?: number;
|
|
99
|
-
stringType?: string;
|
|
100
|
-
terminateValue?: number;
|
|
101
|
-
lengthReadSize?: number;
|
|
102
|
-
stripNull?: boolean;
|
|
103
|
-
encoding?: string;
|
|
104
|
-
endian?: string;
|
|
105
|
-
}): string;
|
|
106
|
-
export declare function wstring(_this: BiReader | BiWriter | ReaderBase, string: string, options?: {
|
|
107
|
-
length?: number;
|
|
108
|
-
stringType?: string;
|
|
109
|
-
terminateValue?: number;
|
|
110
|
-
lengthWriteSize?: number;
|
|
111
|
-
stripNull?: boolean;
|
|
112
|
-
encoding?: string;
|
|
113
|
-
endian?: string;
|
|
114
|
-
}): void;
|
|
115
|
-
export declare class ReaderBase {
|
|
2
|
+
import { endian, hexdumpOptions, stringOptions } from '../common.js';
|
|
3
|
+
export declare function hexDumpBase(ctx: BiBase, options?: hexdumpOptions): string;
|
|
4
|
+
export declare function skip(ctx: BiBase, bytes: number, bits?: number): void;
|
|
5
|
+
export declare function align(ctx: BiBase, n: number): void;
|
|
6
|
+
export declare function alignRev(ctx: BiBase, n: number): void;
|
|
7
|
+
export declare function goto(ctx: BiBase, bytes: number, bits?: number): void;
|
|
8
|
+
export declare function check_size(ctx: BiBase, write_bytes: number, write_bit?: number, offset?: number): number;
|
|
9
|
+
export declare function checkSize(ctx: BiBase, write_bytes: number, write_bit?: number, offset?: number): number;
|
|
10
|
+
export declare function extendarray(ctx: BiBase, to_padd: number): void;
|
|
11
|
+
export declare function remove(ctx: BiBase, startOffset?: number, endOffset?: number, consume?: boolean, remove?: boolean, fillValue?: number): any;
|
|
12
|
+
export declare function addData(ctx: BiBase, data: Buffer | Uint8Array, consume?: boolean, offset?: number, replace?: boolean): void;
|
|
13
|
+
export declare function AND(ctx: BiBase, and_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
14
|
+
export declare function OR(ctx: BiBase, or_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
15
|
+
export declare function XOR(ctx: BiBase, xor_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
16
|
+
export declare function NOT(ctx: BiBase, start?: number, end?: number, consume?: boolean): any;
|
|
17
|
+
export declare function LSHIFT(ctx: BiBase, shift_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
18
|
+
export declare function RSHIFT(ctx: BiBase, shift_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
19
|
+
export declare function ADD(ctx: BiBase, add_key: any, start?: number, end?: number, consume?: boolean): any;
|
|
20
|
+
export declare function fString(ctx: BiBase, searchString: string): number;
|
|
21
|
+
export declare function fNumber(ctx: BiBase, targetNumber: number, bits: number, unsigned: boolean, endian?: string): number;
|
|
22
|
+
export declare function fHalfFloat(ctx: BiBase, targetNumber: number, endian?: string): number;
|
|
23
|
+
export declare function fFloat(ctx: BiBase, targetNumber: number, endian?: string): number;
|
|
24
|
+
export declare function fBigInt(ctx: BiBase, targetNumber: number, unsigned: boolean, endian?: string): number;
|
|
25
|
+
export declare function fDoubleFloat(ctx: BiBase, targetNumber: number, endian?: string): number;
|
|
26
|
+
export declare function wbit(ctx: BiBase, value: number, bits: number, unsigned?: boolean, endian?: string): void;
|
|
27
|
+
export declare function rbit(ctx: BiBase, bits?: number, unsigned?: boolean, endian?: string): number;
|
|
28
|
+
export declare function wbyte(ctx: BiBase, value: number, unsigned?: boolean): void;
|
|
29
|
+
export declare function rbyte(ctx: BiBase, unsigned?: boolean): number;
|
|
30
|
+
export declare function wint16(ctx: BiBase, value: number, unsigned?: boolean, endian?: string): void;
|
|
31
|
+
export declare function rint16(ctx: BiBase, unsigned?: boolean, endian?: string): number;
|
|
32
|
+
export declare function rhalffloat(ctx: BiBase, endian?: endian): number;
|
|
33
|
+
export declare function whalffloat(ctx: BiBase, value: number, endian?: string): void;
|
|
34
|
+
export declare function wint32(ctx: BiBase, value: number, unsigned?: boolean, endian?: string): void;
|
|
35
|
+
export declare function rint32(ctx: BiBase, unsigned?: boolean, endian?: string): number;
|
|
36
|
+
export declare function rfloat(ctx: BiBase, endian?: endian): number;
|
|
37
|
+
export declare function wfloat(ctx: BiBase, value: number, endian?: string): void;
|
|
38
|
+
export declare function rint64(ctx: BiBase, unsigned?: boolean, endian?: string): bigint;
|
|
39
|
+
export declare function wint64(ctx: BiBase, value: number, unsigned?: boolean, endian?: string): void;
|
|
40
|
+
export declare function wdfloat(ctx: BiBase, value: number, endian?: string): void;
|
|
41
|
+
export declare function rdfloat(ctx: BiBase, endian?: endian): number;
|
|
42
|
+
export declare function rstring(ctx: BiBase, options?: stringOptions): string;
|
|
43
|
+
export declare function wstring(ctx: BiBase, string: string, options?: stringOptions): void;
|
|
44
|
+
export declare class BiBase {
|
|
116
45
|
/**
|
|
117
46
|
* Endianness of default read.
|
|
118
|
-
* @type {
|
|
47
|
+
* @type {endian}
|
|
119
48
|
*/
|
|
120
|
-
endian:
|
|
49
|
+
endian: endian;
|
|
121
50
|
/**
|
|
122
51
|
* Current read byte location.
|
|
123
52
|
*/
|
|
@@ -157,6 +86,16 @@ export declare class ReaderBase {
|
|
|
157
86
|
* 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.
|
|
158
87
|
*/
|
|
159
88
|
extendBufferSize: number;
|
|
89
|
+
/**
|
|
90
|
+
* The settings that used when using the .str getter / setter
|
|
91
|
+
*/
|
|
92
|
+
private strDefaults;
|
|
93
|
+
/**
|
|
94
|
+
* Settings for when using .str
|
|
95
|
+
*
|
|
96
|
+
* @param {stringOptions} settings options to use with .str
|
|
97
|
+
*/
|
|
98
|
+
set strSettings(settings: stringOptions);
|
|
160
99
|
isBufferOrUint8Array(obj: Buffer | Uint8Array): boolean;
|
|
161
100
|
extendArray(to_padd: number): void;
|
|
162
101
|
/**
|
|
@@ -165,9 +104,9 @@ export declare class ReaderBase {
|
|
|
165
104
|
*
|
|
166
105
|
* Can be changed at any time, doesn't loose position.
|
|
167
106
|
*
|
|
168
|
-
* @param {
|
|
107
|
+
* @param {endian} endian - endianness ``big`` or ``little``
|
|
169
108
|
*/
|
|
170
|
-
endianness(endian:
|
|
109
|
+
endianness(endian: endian): void;
|
|
171
110
|
/**
|
|
172
111
|
* Sets endian to big.
|
|
173
112
|
*/
|
|
@@ -430,9 +369,9 @@ export declare class ReaderBase {
|
|
|
430
369
|
*
|
|
431
370
|
* @param {number} value - Number to search for.
|
|
432
371
|
* @param {boolean} unsigned - If the number is unsigned (default true)
|
|
433
|
-
* @param {
|
|
372
|
+
* @param {endian} endian - endianness of value (default set endian).
|
|
434
373
|
*/
|
|
435
|
-
findByte(value: number, unsigned?: boolean, endian?:
|
|
374
|
+
findByte(value: number, unsigned?: boolean, endian?: endian): number;
|
|
436
375
|
/**
|
|
437
376
|
* Searches for short value (can be signed or unsigned) position from current read position.
|
|
438
377
|
*
|
|
@@ -442,9 +381,9 @@ export declare class ReaderBase {
|
|
|
442
381
|
*
|
|
443
382
|
* @param {number} value - Number to search for.
|
|
444
383
|
* @param {boolean} unsigned - If the number is unsigned (default true)
|
|
445
|
-
* @param {
|
|
384
|
+
* @param {endian} endian - endianness of value (default set endian).
|
|
446
385
|
*/
|
|
447
|
-
findShort(value: number, unsigned?: boolean, endian?:
|
|
386
|
+
findShort(value: number, unsigned?: boolean, endian?: endian): number;
|
|
448
387
|
/**
|
|
449
388
|
* Searches for integer value (can be signed or unsigned) position from current read position.
|
|
450
389
|
*
|
|
@@ -454,9 +393,9 @@ export declare class ReaderBase {
|
|
|
454
393
|
*
|
|
455
394
|
* @param {number} value - Number to search for.
|
|
456
395
|
* @param {boolean} unsigned - If the number is unsigned (default true)
|
|
457
|
-
* @param {
|
|
396
|
+
* @param {endian} endian - endianness of value (default set endian).
|
|
458
397
|
*/
|
|
459
|
-
findInt(value: number, unsigned?: boolean, endian?:
|
|
398
|
+
findInt(value: number, unsigned?: boolean, endian?: endian): number;
|
|
460
399
|
/**
|
|
461
400
|
* Searches for 64 bit value (can be signed or unsigned) position from current read position.
|
|
462
401
|
*
|
|
@@ -466,9 +405,9 @@ export declare class ReaderBase {
|
|
|
466
405
|
*
|
|
467
406
|
* @param {number} value - Number to search for.
|
|
468
407
|
* @param {boolean} unsigned - If the number is unsigned (default true)
|
|
469
|
-
* @param {
|
|
408
|
+
* @param {endian} endian - endianness of value (default set endian).
|
|
470
409
|
*/
|
|
471
|
-
findInt64(value: number, unsigned?: boolean, endian?:
|
|
410
|
+
findInt64(value: number, unsigned?: boolean, endian?: endian): number;
|
|
472
411
|
/**
|
|
473
412
|
* Searches for half float value position from current read position.
|
|
474
413
|
*
|
|
@@ -477,9 +416,9 @@ export declare class ReaderBase {
|
|
|
477
416
|
* Does not change current read position.
|
|
478
417
|
*
|
|
479
418
|
* @param {number} value - Number to search for.
|
|
480
|
-
* @param {
|
|
419
|
+
* @param {endian} endian - endianness of value (default set endian).
|
|
481
420
|
*/
|
|
482
|
-
findHalfFloat(value: number, endian?:
|
|
421
|
+
findHalfFloat(value: number, endian?: endian): number;
|
|
483
422
|
/**
|
|
484
423
|
* Searches for float value position from current read position.
|
|
485
424
|
*
|
|
@@ -488,9 +427,9 @@ export declare class ReaderBase {
|
|
|
488
427
|
* Does not change current read position.
|
|
489
428
|
*
|
|
490
429
|
* @param {number} value - Number to search for.
|
|
491
|
-
* @param {
|
|
430
|
+
* @param {endian} endian - endianness of value (default set endian).
|
|
492
431
|
*/
|
|
493
|
-
findFloat(value: number, endian?:
|
|
432
|
+
findFloat(value: number, endian?: endian): number;
|
|
494
433
|
/**
|
|
495
434
|
* Searches for double float value position from current read position.
|
|
496
435
|
*
|
|
@@ -499,9 +438,9 @@ export declare class ReaderBase {
|
|
|
499
438
|
* Does not change current read position.
|
|
500
439
|
*
|
|
501
440
|
* @param {number} value - Number to search for.
|
|
502
|
-
* @param {
|
|
441
|
+
* @param {endian} endian - endianness of value (default set endian).
|
|
503
442
|
*/
|
|
504
|
-
findDoubleFloat(value: number, endian?:
|
|
443
|
+
findDoubleFloat(value: number, endian?: endian): number;
|
|
505
444
|
/**
|
|
506
445
|
* Aligns current byte position.
|
|
507
446
|
*
|
|
@@ -651,7 +590,7 @@ export declare class ReaderBase {
|
|
|
651
590
|
/**
|
|
652
591
|
* Replaces data in data.
|
|
653
592
|
*
|
|
654
|
-
* Note:
|
|
593
|
+
* Note: Errors on strict mode.
|
|
655
594
|
*
|
|
656
595
|
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
657
596
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
@@ -661,7 +600,7 @@ export declare class ReaderBase {
|
|
|
661
600
|
/**
|
|
662
601
|
* Replaces data in data.
|
|
663
602
|
*
|
|
664
|
-
* Note:
|
|
603
|
+
* Note: Errors on strict mode.
|
|
665
604
|
*
|
|
666
605
|
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
667
606
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
@@ -721,7 +660,7 @@ export declare class ReaderBase {
|
|
|
721
660
|
/**
|
|
722
661
|
* Inserts data into data.
|
|
723
662
|
*
|
|
724
|
-
* Note:
|
|
663
|
+
* Note: Errors on strict mode.
|
|
725
664
|
*
|
|
726
665
|
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
727
666
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
@@ -731,7 +670,7 @@ export declare class ReaderBase {
|
|
|
731
670
|
/**
|
|
732
671
|
* Inserts data into data.
|
|
733
672
|
*
|
|
734
|
-
* Note:
|
|
673
|
+
* Note: Errors on strict mode.
|
|
735
674
|
*
|
|
736
675
|
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
737
676
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
@@ -741,7 +680,7 @@ export declare class ReaderBase {
|
|
|
741
680
|
/**
|
|
742
681
|
* Adds data to start of supplied data.
|
|
743
682
|
*
|
|
744
|
-
* Note:
|
|
683
|
+
* Note: Errors on strict mode.
|
|
745
684
|
*
|
|
746
685
|
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
747
686
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
@@ -750,7 +689,7 @@ export declare class ReaderBase {
|
|
|
750
689
|
/**
|
|
751
690
|
* Adds data to start of supplied data.
|
|
752
691
|
*
|
|
753
|
-
* Note:
|
|
692
|
+
* Note: Errors on strict mode.
|
|
754
693
|
*
|
|
755
694
|
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
756
695
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
@@ -759,7 +698,7 @@ export declare class ReaderBase {
|
|
|
759
698
|
/**
|
|
760
699
|
* Adds data to end of supplied data.
|
|
761
700
|
*
|
|
762
|
-
* Note:
|
|
701
|
+
* Note: Errors on strict mode.
|
|
763
702
|
*
|
|
764
703
|
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
765
704
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
@@ -768,7 +707,7 @@ export declare class ReaderBase {
|
|
|
768
707
|
/**
|
|
769
708
|
* Adds data to end of supplied data.
|
|
770
709
|
*
|
|
771
|
-
* Note:
|
|
710
|
+
* Note: Errors on strict mode.
|
|
772
711
|
*
|
|
773
712
|
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
774
713
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
@@ -900,9 +839,9 @@ export declare class ReaderBase {
|
|
|
900
839
|
* @param {number} value - value as int
|
|
901
840
|
* @param {number} bits - number of bits to write
|
|
902
841
|
* @param {boolean} unsigned - if value is unsigned
|
|
903
|
-
* @param {
|
|
842
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
904
843
|
*/
|
|
905
|
-
writeBit(value: number, bits: number, unsigned?: boolean, endian?:
|
|
844
|
+
writeBit(value: number, bits: number, unsigned?: boolean, endian?: endian): void;
|
|
906
845
|
/**
|
|
907
846
|
* Bit field writer.
|
|
908
847
|
*
|
|
@@ -952,10 +891,10 @@ export declare class ReaderBase {
|
|
|
952
891
|
*
|
|
953
892
|
* @param {number} bits - bits to read
|
|
954
893
|
* @param {boolean} unsigned - if the value is unsigned
|
|
955
|
-
* @param {
|
|
894
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
956
895
|
* @returns {number}
|
|
957
896
|
*/
|
|
958
|
-
readBit(bits?: number, unsigned?: boolean, endian?:
|
|
897
|
+
readBit(bits?: number, unsigned?: boolean, endian?: endian): number;
|
|
959
898
|
/**
|
|
960
899
|
* Bit field reader.
|
|
961
900
|
*
|
|
@@ -1039,25 +978,25 @@ export declare class ReaderBase {
|
|
|
1039
978
|
* Read short.
|
|
1040
979
|
*
|
|
1041
980
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
1042
|
-
* @param {
|
|
981
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1043
982
|
* @returns {number}
|
|
1044
983
|
*/
|
|
1045
|
-
readInt16(unsigned?: boolean, endian?:
|
|
984
|
+
readInt16(unsigned?: boolean, endian?: endian): number;
|
|
1046
985
|
/**
|
|
1047
986
|
* Write int16.
|
|
1048
987
|
*
|
|
1049
988
|
* @param {number} value - value as int
|
|
1050
989
|
* @param {boolean} unsigned - if the value is unsigned
|
|
1051
|
-
* @param {
|
|
990
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1052
991
|
*/
|
|
1053
|
-
writeInt16(value: number, unsigned?: boolean, endian?:
|
|
992
|
+
writeInt16(value: number, unsigned?: boolean, endian?: endian): void;
|
|
1054
993
|
/**
|
|
1055
994
|
* Write unsigned int16.
|
|
1056
995
|
*
|
|
1057
996
|
* @param {number} value - value as int
|
|
1058
|
-
* @param {
|
|
997
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1059
998
|
*/
|
|
1060
|
-
writeUInt16(value: number, endian?:
|
|
999
|
+
writeUInt16(value: number, endian?: endian): void;
|
|
1061
1000
|
/**
|
|
1062
1001
|
* Write unsigned int16.
|
|
1063
1002
|
*
|
|
@@ -1079,11 +1018,11 @@ export declare class ReaderBase {
|
|
|
1079
1018
|
/**
|
|
1080
1019
|
* Read unsigned short.
|
|
1081
1020
|
*
|
|
1082
|
-
* @param {
|
|
1021
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1083
1022
|
*
|
|
1084
1023
|
* @returns {number}
|
|
1085
1024
|
*/
|
|
1086
|
-
readUInt16(endian?:
|
|
1025
|
+
readUInt16(endian?: endian): number;
|
|
1087
1026
|
/**
|
|
1088
1027
|
* Read unsigned short in little endian.
|
|
1089
1028
|
*
|
|
@@ -1111,17 +1050,17 @@ export declare class ReaderBase {
|
|
|
1111
1050
|
/**
|
|
1112
1051
|
* Read half float.
|
|
1113
1052
|
*
|
|
1114
|
-
* @param {
|
|
1053
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1115
1054
|
* @returns {number}
|
|
1116
1055
|
*/
|
|
1117
|
-
readHalfFloat(endian?:
|
|
1056
|
+
readHalfFloat(endian?: endian): number;
|
|
1118
1057
|
/**
|
|
1119
1058
|
* Writes half float.
|
|
1120
1059
|
*
|
|
1121
1060
|
* @param {number} value - value as int
|
|
1122
|
-
* @param {
|
|
1061
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1123
1062
|
*/
|
|
1124
|
-
writeHalfFloat(value: number, endian?:
|
|
1063
|
+
writeHalfFloat(value: number, endian?: endian): void;
|
|
1125
1064
|
/**
|
|
1126
1065
|
* Writes half float.
|
|
1127
1066
|
*
|
|
@@ -1150,25 +1089,25 @@ export declare class ReaderBase {
|
|
|
1150
1089
|
* Read 32 bit integer.
|
|
1151
1090
|
*
|
|
1152
1091
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
1153
|
-
* @param {
|
|
1092
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1154
1093
|
* @returns {number}
|
|
1155
1094
|
*/
|
|
1156
|
-
readInt32(unsigned?: boolean, endian?:
|
|
1095
|
+
readInt32(unsigned?: boolean, endian?: endian): number;
|
|
1157
1096
|
/**
|
|
1158
1097
|
* Write int32.
|
|
1159
1098
|
*
|
|
1160
1099
|
* @param {number} value - value as int
|
|
1161
1100
|
* @param {boolean} unsigned - if the value is unsigned
|
|
1162
|
-
* @param {
|
|
1101
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1163
1102
|
*/
|
|
1164
|
-
writeInt32(value: number, unsigned?: boolean, endian?:
|
|
1103
|
+
writeInt32(value: number, unsigned?: boolean, endian?: endian): void;
|
|
1165
1104
|
/**
|
|
1166
1105
|
* Write unsigned int32.
|
|
1167
1106
|
*
|
|
1168
1107
|
* @param {number} value - value as int
|
|
1169
|
-
* @param {
|
|
1108
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1170
1109
|
*/
|
|
1171
|
-
writeUInt32(value: number, endian?:
|
|
1110
|
+
writeUInt32(value: number, endian?: endian): void;
|
|
1172
1111
|
/**
|
|
1173
1112
|
* Write signed int32.
|
|
1174
1113
|
*
|
|
@@ -1220,17 +1159,17 @@ export declare class ReaderBase {
|
|
|
1220
1159
|
/**
|
|
1221
1160
|
* Read float.
|
|
1222
1161
|
*
|
|
1223
|
-
* @param {
|
|
1162
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1224
1163
|
* @returns {number}
|
|
1225
1164
|
*/
|
|
1226
|
-
readFloat(endian?:
|
|
1165
|
+
readFloat(endian?: endian): number;
|
|
1227
1166
|
/**
|
|
1228
1167
|
* Write float.
|
|
1229
1168
|
*
|
|
1230
1169
|
* @param {number} value - value as int
|
|
1231
|
-
* @param {
|
|
1170
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1232
1171
|
*/
|
|
1233
|
-
writeFloat(value: number, endian?:
|
|
1172
|
+
writeFloat(value: number, endian?: endian): void;
|
|
1234
1173
|
/**
|
|
1235
1174
|
* Write float.
|
|
1236
1175
|
*
|
|
@@ -1259,25 +1198,25 @@ export declare class ReaderBase {
|
|
|
1259
1198
|
* Read signed 64 bit integer.
|
|
1260
1199
|
*
|
|
1261
1200
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
1262
|
-
* @param {
|
|
1201
|
+
* @param {endian?} endian - ``big`` or ``little``
|
|
1263
1202
|
* @returns {number}
|
|
1264
1203
|
*/
|
|
1265
|
-
readInt64(unsigned?: boolean, endian?:
|
|
1204
|
+
readInt64(unsigned?: boolean, endian?: endian): bigint;
|
|
1266
1205
|
/**
|
|
1267
1206
|
* Write 64 bit integer.
|
|
1268
1207
|
*
|
|
1269
1208
|
* @param {number} value - value as int
|
|
1270
1209
|
* @param {boolean} unsigned - if the value is unsigned
|
|
1271
|
-
* @param {
|
|
1210
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1272
1211
|
*/
|
|
1273
|
-
writeInt64(value: number, unsigned?: boolean, endian?:
|
|
1212
|
+
writeInt64(value: number, unsigned?: boolean, endian?: endian): void;
|
|
1274
1213
|
/**
|
|
1275
1214
|
* Write unsigned 64 bit integer.
|
|
1276
1215
|
*
|
|
1277
1216
|
* @param {number} value - value as int
|
|
1278
|
-
* @param {
|
|
1217
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1279
1218
|
*/
|
|
1280
|
-
writeUInt64(value: number, endian?:
|
|
1219
|
+
writeUInt64(value: number, endian?: endian): void;
|
|
1281
1220
|
/**
|
|
1282
1221
|
* Write signed 64 bit integer.
|
|
1283
1222
|
*
|
|
@@ -1335,17 +1274,17 @@ export declare class ReaderBase {
|
|
|
1335
1274
|
/**
|
|
1336
1275
|
* Read double float.
|
|
1337
1276
|
*
|
|
1338
|
-
* @param {
|
|
1277
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1339
1278
|
* @returns {number}
|
|
1340
1279
|
*/
|
|
1341
|
-
readDoubleFloat(endian?:
|
|
1280
|
+
readDoubleFloat(endian?: endian): number;
|
|
1342
1281
|
/**
|
|
1343
1282
|
* Writes double float.
|
|
1344
1283
|
*
|
|
1345
1284
|
* @param {number} value - value as int
|
|
1346
|
-
* @param {
|
|
1285
|
+
* @param {endian} endian - ``big`` or ``little``
|
|
1347
1286
|
*/
|
|
1348
|
-
writeDoubleFloat(value: number, endian?:
|
|
1287
|
+
writeDoubleFloat(value: number, endian?: endian): void;
|
|
1349
1288
|
/**
|
|
1350
1289
|
* Writes double float.
|
|
1351
1290
|
*
|
|
@@ -1373,55 +1312,27 @@ export declare class ReaderBase {
|
|
|
1373
1312
|
/**
|
|
1374
1313
|
* Reads string, use options object for different types.
|
|
1375
1314
|
*
|
|
1376
|
-
* @param {
|
|
1377
|
-
*
|
|
1378
|
-
* {
|
|
1379
|
-
*
|
|
1380
|
-
*
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1383
|
-
*
|
|
1384
|
-
* encoding: "utf-8", //TextEncoder accepted types
|
|
1385
|
-
* endian: "little", //for wide-pascal and utf-16
|
|
1386
|
-
* }
|
|
1387
|
-
* ```
|
|
1388
|
-
* @return string
|
|
1315
|
+
* @param {stringOptions} options
|
|
1316
|
+
* @param {stringOptions["length"]?} options.length - for fixed length, non-terminate value utf strings
|
|
1317
|
+
* @param {stringOptions["stringType"]?} options.stringType - utf-8, utf-16, pascal or wide-pascal
|
|
1318
|
+
* @param {stringOptions["terminateValue"]?} options.terminateValue - only with stringType: "utf"
|
|
1319
|
+
* @param {stringOptions["lengthReadSize"]?} options.lengthReadSize - for pascal strings. 1, 2 or 4 byte length read size
|
|
1320
|
+
* @param {stringOptions["encoding"]?} options.encoding - TextEncoder accepted types
|
|
1321
|
+
* @param {stringOptions["endian"]?} options.endian - for wide-pascal and utf-16
|
|
1322
|
+
* @return {Promise<string>}
|
|
1389
1323
|
*/
|
|
1390
|
-
readString(options?:
|
|
1391
|
-
length?: number;
|
|
1392
|
-
stringType?: string;
|
|
1393
|
-
terminateValue?: number;
|
|
1394
|
-
lengthReadSize?: number;
|
|
1395
|
-
stripNull?: boolean;
|
|
1396
|
-
encoding?: string;
|
|
1397
|
-
endian?: string;
|
|
1398
|
-
}): string;
|
|
1324
|
+
readString(options?: stringOptions): string;
|
|
1399
1325
|
/**
|
|
1400
1326
|
* Writes string, use options object for different types.
|
|
1401
1327
|
*
|
|
1402
|
-
*
|
|
1403
1328
|
* @param {string} string - text string
|
|
1404
|
-
* @param {
|
|
1405
|
-
*
|
|
1406
|
-
* {
|
|
1407
|
-
*
|
|
1408
|
-
*
|
|
1409
|
-
*
|
|
1410
|
-
*
|
|
1411
|
-
* encoding: "utf-8", //TextEncoder accepted types
|
|
1412
|
-
* endian: "little", //for wide-pascal and utf-16
|
|
1413
|
-
* }
|
|
1414
|
-
* ```
|
|
1329
|
+
* @param {stringOptions?} options
|
|
1330
|
+
* @param {stringOptions["length"]?} options.length - for fixed length, non-terminate value utf strings
|
|
1331
|
+
* @param {stringOptions["stringType"]?} options.stringType - utf-8, utf-16, pascal or wide-pascal
|
|
1332
|
+
* @param {stringOptions["terminateValue"]?} options.terminateValue - only with stringType: "utf"
|
|
1333
|
+
* @param {stringOptions["lengthWriteSize"]?} options.lengthWriteSize - for pascal strings. 1, 2 or 4 byte length write size
|
|
1334
|
+
* @param {stringOptions["encoding"]?} options.encoding - TextEncoder accepted types
|
|
1335
|
+
* @param {stringOptions["endian"]?} options.endian - for wide-pascal and utf-16
|
|
1415
1336
|
*/
|
|
1416
|
-
writeString(string: string, options?:
|
|
1417
|
-
length?: number;
|
|
1418
|
-
stringType?: string;
|
|
1419
|
-
terminateValue?: number;
|
|
1420
|
-
lengthWriteSize?: number;
|
|
1421
|
-
stripNull?: boolean;
|
|
1422
|
-
encoding?: string;
|
|
1423
|
-
endian?: string;
|
|
1424
|
-
}): void;
|
|
1337
|
+
writeString(string: string, options?: stringOptions): void;
|
|
1425
1338
|
}
|
|
1426
|
-
export {};
|
|
1427
|
-
//# sourceMappingURL=common.d.ts.map
|