bireader 3.1.0 → 3.1.2

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.
@@ -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: any;
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
- isBufferOrUint8Array(obj: Buffer | Uint8Array): boolean;
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
  */
@@ -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
- * 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
- */
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).