-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWalkableBufferOptions.ts
39 lines (38 loc) · 1.2 KB
/
WalkableBufferOptions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Encoding } from "./Encoding.js";
import { Endianness } from "./Endianness.js";
/**
* The options to provide into the constructor of `WalkableBuffer`.
* Allows you to configure the _defaults_ for reading data from the buffer.
*
* The class methods can override the settings for each call, but the deafult for the instance as a whole
* can be useful since most data in buffers will be of same endianness or encoding.
*/
export interface WalkableBufferOptions {
/** The `Buffer` to read and walk. */
buffer: Buffer;
/**
* The starting position of the cursor.
*
* _Defaults to `0`_
*/
initialCursor?: number;
/**
* The endianness to read numbers with. `LE` little-endian or `BE` big-endian.
*
* _Defaults to `LE`_
*/
endianness?: Endianness;
/**
* The encoding to read text with.
* Valid text encodings are `ascii`, `utf8`, `utf16le`, `ucs2`(alias of `utf16le`), `base64`, `hex`.
*
* _Defaults to `utf8`_
*/
encoding?: Encoding;
/**
* If number functions (`getBigInt()`) should default to read numbers as signed integers
*
* _Defaults to `true` (signed integers)_
*/
signed?: boolean;
}