bireader 3.1.1 → 3.1.3
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 +1 -1
- package/dist/aliases/BinaryAliasReader.d.ts +36 -36
- package/dist/aliases/BinaryAliasWriter.d.ts +72 -72
- package/dist/core/BiBase.d.ts +58 -68
- package/dist/core/BiBaseStream.d.ts +30 -30
- package/dist/index.browser.d.ts +112 -81
- package/dist/index.browser.js +145 -95
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.d.ts +196 -165
- package/dist/index.cjs.js +204 -171
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +196 -165
- package/dist/index.esm.d.ts +196 -165
- package/dist/index.esm.js +204 -171
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.json +0 -15
package/dist/core/BiBase.d.ts
CHANGED
|
@@ -1,46 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
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
3
|
export declare class BiBase {
|
|
45
4
|
/**
|
|
46
5
|
* Endianness of default read.
|
|
@@ -73,9 +32,9 @@ export declare class BiBase {
|
|
|
73
32
|
errorDump: boolean;
|
|
74
33
|
/**
|
|
75
34
|
* Current buffer data.
|
|
76
|
-
* @type {Buffer|Uint8Array}
|
|
35
|
+
* @type {Buffer|Uint8Array|null}
|
|
77
36
|
*/
|
|
78
|
-
data:
|
|
37
|
+
data: Buffer | Uint8Array | null;
|
|
79
38
|
/**
|
|
80
39
|
* When the data buffer needs to be extended while strict mode is ``false``, this will be the amount it extends.
|
|
81
40
|
*
|
|
@@ -86,18 +45,53 @@ export declare class BiBase {
|
|
|
86
45
|
* 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.
|
|
87
46
|
*/
|
|
88
47
|
extendBufferSize: number;
|
|
48
|
+
fd: any;
|
|
49
|
+
filePath: string;
|
|
50
|
+
fsMode: string;
|
|
89
51
|
/**
|
|
90
52
|
* The settings that used when using the .str getter / setter
|
|
91
53
|
*/
|
|
92
54
|
private strDefaults;
|
|
55
|
+
maxFileSize: number | null;
|
|
56
|
+
constructor();
|
|
93
57
|
/**
|
|
94
58
|
* Settings for when using .str
|
|
95
59
|
*
|
|
96
60
|
* @param {stringOptions} settings options to use with .str
|
|
97
61
|
*/
|
|
98
62
|
set strSettings(settings: stringOptions);
|
|
99
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Enables expanding in reader (changes strict)
|
|
65
|
+
*
|
|
66
|
+
* @param {boolean} mode - Enable expanding in reader (changes strict)
|
|
67
|
+
*/
|
|
68
|
+
writeMode(mode: boolean): void;
|
|
69
|
+
/**
|
|
70
|
+
* Dummy function, not needed on Non-Stream
|
|
71
|
+
*/
|
|
72
|
+
open(): number;
|
|
73
|
+
/**
|
|
74
|
+
* Dummy function, not needed on Non-Stream
|
|
75
|
+
*/
|
|
76
|
+
updateSize(): void;
|
|
77
|
+
/**
|
|
78
|
+
* removes data.
|
|
79
|
+
*/
|
|
80
|
+
close(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Dummy function, not needed on Non-Stream
|
|
83
|
+
*/
|
|
84
|
+
read(start: number, length: number, consume?: boolean): Buffer | Uint8Array;
|
|
85
|
+
/**
|
|
86
|
+
* Dummy function, not needed on Non-Stream
|
|
87
|
+
*/
|
|
88
|
+
write(start: number, data: Buffer, consume?: boolean): number;
|
|
89
|
+
/**
|
|
90
|
+
* Dummy function, not needed on Non-Stream
|
|
91
|
+
*/
|
|
92
|
+
commit(consume?: boolean): number;
|
|
100
93
|
extendArray(to_padd: number): void;
|
|
94
|
+
isBufferOrUint8Array(obj: Buffer | Uint8Array): boolean;
|
|
101
95
|
/**
|
|
102
96
|
*
|
|
103
97
|
* Change endian, defaults to little.
|
|
@@ -338,10 +332,6 @@ export declare class BiBase {
|
|
|
338
332
|
* removes data.
|
|
339
333
|
*/
|
|
340
334
|
end(): void;
|
|
341
|
-
/**
|
|
342
|
-
* removes data.
|
|
343
|
-
*/
|
|
344
|
-
close(): void;
|
|
345
335
|
/**
|
|
346
336
|
* removes data.
|
|
347
337
|
*/
|
|
@@ -403,11 +393,11 @@ export declare class BiBase {
|
|
|
403
393
|
*
|
|
404
394
|
* Does not change current read position.
|
|
405
395
|
*
|
|
406
|
-
* @param {number} value - Number to search for.
|
|
396
|
+
* @param {number|bigint} value - Number to search for.
|
|
407
397
|
* @param {boolean} unsigned - If the number is unsigned (default true)
|
|
408
398
|
* @param {endian} endian - endianness of value (default set endian).
|
|
409
399
|
*/
|
|
410
|
-
findInt64(value: number, unsigned?: boolean, endian?: endian): number;
|
|
400
|
+
findInt64(value: number | bigint, unsigned?: boolean, endian?: endian): number;
|
|
411
401
|
/**
|
|
412
402
|
* Searches for half float value position from current read position.
|
|
413
403
|
*
|
|
@@ -1199,76 +1189,76 @@ export declare class BiBase {
|
|
|
1199
1189
|
*
|
|
1200
1190
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
1201
1191
|
* @param {endian?} endian - ``big`` or ``little``
|
|
1202
|
-
* @returns {
|
|
1192
|
+
* @returns {bigint}
|
|
1203
1193
|
*/
|
|
1204
1194
|
readInt64(unsigned?: boolean, endian?: endian): bigint;
|
|
1205
1195
|
/**
|
|
1206
1196
|
* Write 64 bit integer.
|
|
1207
1197
|
*
|
|
1208
|
-
* @param {number} value - value as int
|
|
1198
|
+
* @param {number|bigint} value - value as int
|
|
1209
1199
|
* @param {boolean} unsigned - if the value is unsigned
|
|
1210
1200
|
* @param {endian} endian - ``big`` or ``little``
|
|
1211
1201
|
*/
|
|
1212
|
-
writeInt64(value: number, unsigned?: boolean, endian?: endian): void;
|
|
1202
|
+
writeInt64(value: number | bigint, unsigned?: boolean, endian?: endian): void;
|
|
1213
1203
|
/**
|
|
1214
1204
|
* Write unsigned 64 bit integer.
|
|
1215
1205
|
*
|
|
1216
|
-
* @param {number} value - value as int
|
|
1206
|
+
* @param {number|bigint} value - value as int
|
|
1217
1207
|
* @param {endian} endian - ``big`` or ``little``
|
|
1218
1208
|
*/
|
|
1219
|
-
writeUInt64(value: number, endian?: endian): void;
|
|
1209
|
+
writeUInt64(value: number | bigint, endian?: endian): void;
|
|
1220
1210
|
/**
|
|
1221
1211
|
* Write signed 64 bit integer.
|
|
1222
1212
|
*
|
|
1223
|
-
* @param {number} value - value as int
|
|
1213
|
+
* @param {number|bigint} value - value as int
|
|
1224
1214
|
*/
|
|
1225
|
-
writeInt64LE(value: number): void;
|
|
1215
|
+
writeInt64LE(value: number | bigint): void;
|
|
1226
1216
|
/**
|
|
1227
1217
|
* Write unsigned 64 bit integer.
|
|
1228
1218
|
*
|
|
1229
|
-
* @param {number} value - value as int
|
|
1219
|
+
* @param {number|bigint} value - value as int
|
|
1230
1220
|
*/
|
|
1231
|
-
writeUInt64LE(value: number): void;
|
|
1221
|
+
writeUInt64LE(value: number | bigint): void;
|
|
1232
1222
|
/**
|
|
1233
1223
|
* Write signed 64 bit integer.
|
|
1234
1224
|
*
|
|
1235
|
-
* @param {number} value - value as int
|
|
1225
|
+
* @param {number|bigint} value - value as int
|
|
1236
1226
|
*/
|
|
1237
|
-
writeInt64BE(value: number): void;
|
|
1227
|
+
writeInt64BE(value: number | bigint): void;
|
|
1238
1228
|
/**
|
|
1239
1229
|
* Write unsigned 64 bit integer.
|
|
1240
1230
|
*
|
|
1241
|
-
* @param {number} value - value as int
|
|
1231
|
+
* @param {number|bigint} value - value as int
|
|
1242
1232
|
*/
|
|
1243
|
-
writeUInt64BE(value: number): void;
|
|
1233
|
+
writeUInt64BE(value: number | bigint): void;
|
|
1244
1234
|
/**
|
|
1245
1235
|
* Read unsigned 64 bit integer.
|
|
1246
1236
|
*
|
|
1247
|
-
* @returns {
|
|
1237
|
+
* @returns {bigint}
|
|
1248
1238
|
*/
|
|
1249
1239
|
readUInt64(): bigint;
|
|
1250
1240
|
/**
|
|
1251
1241
|
* Read signed 64 bit integer.
|
|
1252
1242
|
*
|
|
1253
|
-
* @returns {
|
|
1243
|
+
* @returns {bigint}
|
|
1254
1244
|
*/
|
|
1255
1245
|
readInt64BE(): bigint;
|
|
1256
1246
|
/**
|
|
1257
1247
|
* Read unsigned 64 bit integer.
|
|
1258
1248
|
*
|
|
1259
|
-
* @returns {
|
|
1249
|
+
* @returns {bigint}
|
|
1260
1250
|
*/
|
|
1261
1251
|
readUInt64BE(): bigint;
|
|
1262
1252
|
/**
|
|
1263
1253
|
* Read signed 64 bit integer.
|
|
1264
1254
|
*
|
|
1265
|
-
* @returns {
|
|
1255
|
+
* @returns {bigint}
|
|
1266
1256
|
*/
|
|
1267
1257
|
readInt64LE(): bigint;
|
|
1268
1258
|
/**
|
|
1269
1259
|
* Read unsigned 64 bit integer.
|
|
1270
1260
|
*
|
|
1271
|
-
* @returns {
|
|
1261
|
+
* @returns {bigint}
|
|
1272
1262
|
*/
|
|
1273
1263
|
readUInt64LE(): bigint;
|
|
1274
1264
|
/**
|
|
@@ -42,7 +42,7 @@ export declare class BiBaseStreamer {
|
|
|
42
42
|
/**
|
|
43
43
|
* Current buffer chunk.
|
|
44
44
|
*
|
|
45
|
-
* @type {Buffer}
|
|
45
|
+
* @type {Buffer|null}
|
|
46
46
|
*/
|
|
47
47
|
data: Buffer | null;
|
|
48
48
|
/**
|
|
@@ -336,15 +336,15 @@ export declare class BiBaseStreamer {
|
|
|
336
336
|
*/
|
|
337
337
|
get return(): Buffer;
|
|
338
338
|
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
339
|
+
* Creates hex dump string. Will console log or return string if set in options.
|
|
340
|
+
*
|
|
341
|
+
* @param {object} options
|
|
342
|
+
* @param {hexdumpOptions?} options - hex dump options
|
|
343
|
+
* @param {number?} options.length - number of bytes to log, default ``192`` or end of data
|
|
344
|
+
* @param {number?} options.startByte - byte to start dump (default ``0``)
|
|
345
|
+
* @param {boolean?} options.supressUnicode - Supress unicode character preview for even columns.
|
|
346
|
+
* @param {boolean?} options.returnString - Returns the hex dump string instead of logging it.
|
|
347
|
+
*/
|
|
348
348
|
hexdump(options?: hexdumpOptions): void | string;
|
|
349
349
|
/**
|
|
350
350
|
* Turn hexdump on error off (default on).
|
|
@@ -427,11 +427,11 @@ export declare class BiBaseStreamer {
|
|
|
427
427
|
*
|
|
428
428
|
* Does not change current read position.
|
|
429
429
|
*
|
|
430
|
-
* @param {number} value - Number to search for.
|
|
430
|
+
* @param {number|bigint} value - Number to search for.
|
|
431
431
|
* @param {boolean} unsigned - If the number is unsigned (default true)
|
|
432
432
|
* @param {endian} endian - endianness of value (default set endian).
|
|
433
433
|
*/
|
|
434
|
-
findInt64(value: number, unsigned?: boolean, endian?: endian): number;
|
|
434
|
+
findInt64(value: number | bigint, unsigned?: boolean, endian?: endian): number;
|
|
435
435
|
/**
|
|
436
436
|
* Searches for half float value position from current read position.
|
|
437
437
|
*
|
|
@@ -1223,76 +1223,76 @@ export declare class BiBaseStreamer {
|
|
|
1223
1223
|
*
|
|
1224
1224
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
1225
1225
|
* @param {endian?} endian - ``big`` or ``little``
|
|
1226
|
-
* @returns {
|
|
1226
|
+
* @returns {bigint}
|
|
1227
1227
|
*/
|
|
1228
1228
|
readInt64(unsigned?: boolean, endian?: endian): bigint;
|
|
1229
1229
|
/**
|
|
1230
1230
|
* Write 64 bit integer.
|
|
1231
1231
|
*
|
|
1232
|
-
* @param {number} value - value as int
|
|
1232
|
+
* @param {number|bigint} value - value as int
|
|
1233
1233
|
* @param {boolean} unsigned - if the value is unsigned
|
|
1234
1234
|
* @param {endian} endian - ``big`` or ``little``
|
|
1235
1235
|
*/
|
|
1236
|
-
writeInt64(value: number, unsigned?: boolean, endian?: endian): void;
|
|
1236
|
+
writeInt64(value: number | bigint, unsigned?: boolean, endian?: endian): void;
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Write unsigned 64 bit integer.
|
|
1239
1239
|
*
|
|
1240
|
-
* @param {number} value - value as int
|
|
1240
|
+
* @param {number|bigint} value - value as int
|
|
1241
1241
|
* @param {endian} endian - ``big`` or ``little``
|
|
1242
1242
|
*/
|
|
1243
|
-
writeUInt64(value: number, endian?: endian): void;
|
|
1243
|
+
writeUInt64(value: number | bigint, endian?: endian): void;
|
|
1244
1244
|
/**
|
|
1245
1245
|
* Write signed 64 bit integer.
|
|
1246
1246
|
*
|
|
1247
|
-
* @param {number} value - value as int
|
|
1247
|
+
* @param {number|bigint} value - value as int
|
|
1248
1248
|
*/
|
|
1249
|
-
writeInt64LE(value: number): void;
|
|
1249
|
+
writeInt64LE(value: number | bigint): void;
|
|
1250
1250
|
/**
|
|
1251
1251
|
* Write unsigned 64 bit integer.
|
|
1252
1252
|
*
|
|
1253
|
-
* @param {number} value - value as int
|
|
1253
|
+
* @param {number|bigint} value - value as int
|
|
1254
1254
|
*/
|
|
1255
|
-
writeUInt64LE(value: number): void;
|
|
1255
|
+
writeUInt64LE(value: number | bigint): void;
|
|
1256
1256
|
/**
|
|
1257
1257
|
* Write signed 64 bit integer.
|
|
1258
1258
|
*
|
|
1259
|
-
* @param {number} value - value as int
|
|
1259
|
+
* @param {number|bigint} value - value as int
|
|
1260
1260
|
*/
|
|
1261
|
-
writeInt64BE(value: number): void;
|
|
1261
|
+
writeInt64BE(value: number | bigint): void;
|
|
1262
1262
|
/**
|
|
1263
1263
|
* Write unsigned 64 bit integer.
|
|
1264
1264
|
*
|
|
1265
|
-
* @param {number} value - value as int
|
|
1265
|
+
* @param {number|bigint} value - value as int
|
|
1266
1266
|
*/
|
|
1267
|
-
writeUInt64BE(value: number): void;
|
|
1267
|
+
writeUInt64BE(value: number | bigint): void;
|
|
1268
1268
|
/**
|
|
1269
1269
|
* Read unsigned 64 bit integer.
|
|
1270
1270
|
*
|
|
1271
|
-
* @returns {
|
|
1271
|
+
* @returns {bigint}
|
|
1272
1272
|
*/
|
|
1273
1273
|
readUInt64(): bigint;
|
|
1274
1274
|
/**
|
|
1275
1275
|
* Read signed 64 bit integer.
|
|
1276
1276
|
*
|
|
1277
|
-
* @returns {
|
|
1277
|
+
* @returns {bigint}
|
|
1278
1278
|
*/
|
|
1279
1279
|
readInt64BE(): bigint;
|
|
1280
1280
|
/**
|
|
1281
1281
|
* Read unsigned 64 bit integer.
|
|
1282
1282
|
*
|
|
1283
|
-
* @returns {
|
|
1283
|
+
* @returns {bigint}
|
|
1284
1284
|
*/
|
|
1285
1285
|
readUInt64BE(): bigint;
|
|
1286
1286
|
/**
|
|
1287
1287
|
* Read signed 64 bit integer.
|
|
1288
1288
|
*
|
|
1289
|
-
* @returns {
|
|
1289
|
+
* @returns {bigint}
|
|
1290
1290
|
*/
|
|
1291
1291
|
readInt64LE(): bigint;
|
|
1292
1292
|
/**
|
|
1293
1293
|
* Read unsigned 64 bit integer.
|
|
1294
1294
|
*
|
|
1295
|
-
* @returns {
|
|
1295
|
+
* @returns {bigint}
|
|
1296
1296
|
*/
|
|
1297
1297
|
readUInt64LE(): bigint;
|
|
1298
1298
|
/**
|