extended-buffer 6.0.5 → 7.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 +273 -94
- package/dist/ExtendedBuffer.d.ts +61 -66
- package/dist/ExtendedBuffer.js +306 -275
- package/dist/ExtendedBufferOptions.d.ts +4 -3
- package/dist/errors/ExtendedBufferError.d.ts +2 -0
- package/dist/errors/ExtendedBufferError.js +6 -0
- package/dist/errors/ExtendedBufferRangeError.d.ts +3 -0
- package/dist/errors/ExtendedBufferRangeError.js +7 -0
- package/dist/errors/ExtendedBufferTypeError.d.ts +3 -0
- package/dist/errors/ExtendedBufferTypeError.js +7 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.js +9 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +16 -0
- package/dist/utils/alloc-native-buffer.d.ts +2 -0
- package/dist/utils/alloc-native-buffer.js +15 -0
- package/dist/utils/assert-integer-size.d.ts +1 -0
- package/dist/utils/assert-integer-size.js +13 -0
- package/dist/utils/assert-integer.d.ts +1 -0
- package/dist/utils/assert-integer.js +10 -0
- package/dist/utils/assert-unsigned-integer.d.ts +1 -0
- package/dist/utils/assert-unsigned-integer.js +10 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/realloc-native-buffer.d.ts +2 -0
- package/dist/utils/realloc-native-buffer.js +15 -0
- package/package.json +34 -5
package/README.md
CHANGED
|
@@ -1,105 +1,284 @@
|
|
|
1
1
|
[](https://badge.fury.io/js/extended-buffer)
|
|
2
|
-
# node-extended-buffer
|
|
3
|
-
Node JS extended Buffer
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
# ExtendedBuffer
|
|
4
|
+
|
|
5
|
+
`ExtendedBuffer` is a growable binary buffer built on top of Node.js `Buffer`.
|
|
6
|
+
It keeps an internal **read pointer** (similar to a stream cursor) and supports **appending** data at the end or **prepending** data at the start.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Install
|
|
6
11
|
```bash
|
|
7
|
-
npm install extended-buffer
|
|
12
|
+
npm install extended-buffer
|
|
8
13
|
```
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { ExtendedBuffer } from 'extended-buffer';
|
|
21
|
+
|
|
22
|
+
const b = new ExtendedBuffer();
|
|
23
|
+
|
|
24
|
+
b.writeString("OK"); // append
|
|
25
|
+
b.writeUInt16BE(1337); // append
|
|
26
|
+
|
|
27
|
+
console.log(b.readString(2)); // "OK"
|
|
28
|
+
console.log(b.readUInt16BE()); // 1337
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Core concepts
|
|
34
|
+
|
|
35
|
+
### Stored data vs readable data
|
|
36
|
+
|
|
37
|
+
The buffer stores a contiguous region of bytes. A separate **read pointer** tracks how many bytes were already consumed.
|
|
15
38
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
39
|
+
- `length` — total stored bytes (**including already-read bytes**).
|
|
40
|
+
- `getReadableSize()` — unread bytes remaining.
|
|
41
|
+
- `pointer` / `getPointer()` — current read pointer (0…`length`).
|
|
42
|
+
- `nativePointer()` — absolute index inside the underlying `Buffer` for the next read.
|
|
43
|
+
|
|
44
|
+
### Views
|
|
45
|
+
|
|
46
|
+
- `nativeBufferView` — a `Buffer` view of **all stored bytes** (from the start of stored data to the end).
|
|
47
|
+
- If you need only unread bytes, you can derive it:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
const unread = b.nativeBufferView.subarray(b.pointer);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Construction and options
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
type ExtendedBufferOptions = {
|
|
59
|
+
capacity?: number; // initial native buffer size (bytes)
|
|
60
|
+
capacityStep?: number; // how much to grow when resizing
|
|
61
|
+
};
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Defaults (from source):
|
|
65
|
+
|
|
66
|
+
- `capacity`: `512 * 1024` bytes (512 KiB)
|
|
67
|
+
- `capacityStep`: same as `capacity`
|
|
68
|
+
|
|
69
|
+
Example:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
const b = new ExtendedBuffer({ capacity: 64 * 1024, capacityStep: 16 * 1024 });
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Writing data
|
|
78
|
+
|
|
79
|
+
Most write methods accept an optional `unshift?: boolean`:
|
|
80
|
+
|
|
81
|
+
- `unshift = false` (default): append to the end
|
|
82
|
+
- `unshift = true`: prepend to the start
|
|
83
|
+
|
|
84
|
+
### Buffers and strings
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
b.writeNativeBuffer(Buffer.from([1, 2, 3]));
|
|
88
|
+
b.writeBuffer(Buffer.from([4, 5, 6])); // alias that also accepts ExtendedBuffer
|
|
89
|
+
b.writeString("hello", "utf8");
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Prepend example:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
b.writeString("payload");
|
|
96
|
+
b.writeUInt16BE(7, true); // prepend length/header
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Integers
|
|
100
|
+
|
|
101
|
+
Variable-width (size must be **1…6** bytes):
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
b.writeIntBE(-10, 3);
|
|
105
|
+
b.writeUIntLE(5000, 4);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Fixed-width helpers:
|
|
109
|
+
|
|
110
|
+
- `writeInt8`, `writeUInt8`
|
|
111
|
+
- `writeInt16BE`, `writeInt16LE`, `writeUInt16BE`, `writeUInt16LE`
|
|
112
|
+
- `writeInt32BE`, `writeInt32LE`, `writeUInt32BE`, `writeUInt32LE`
|
|
113
|
+
|
|
114
|
+
### Floating point
|
|
115
|
+
|
|
116
|
+
- `writeFloatBE`, `writeFloatLE` (4 bytes)
|
|
117
|
+
- `writeDoubleBE`, `writeDoubleLE` (8 bytes)
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Reading data
|
|
122
|
+
|
|
123
|
+
All `read*` methods **advance** the internal read pointer (consume bytes).
|
|
124
|
+
If there aren’t enough readable bytes, they throw `ExtendedBufferRangeError('SIZE_OUT_OF_RANGE')`.
|
|
125
|
+
|
|
126
|
+
### Checking before reading
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
if (b.isReadable(4)) {
|
|
130
|
+
const x = b.readUInt32BE();
|
|
91
131
|
}
|
|
92
132
|
```
|
|
93
133
|
|
|
94
|
-
###
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
134
|
+
### Read a native `Buffer` or another `ExtendedBuffer`
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
// Copy out as a native Buffer
|
|
138
|
+
const chunk: Buffer = b.readBuffer(10, true);
|
|
139
|
+
|
|
140
|
+
// Copy out as a new ExtendedBuffer (same capacity/capacityStep by default)
|
|
141
|
+
const eb: ExtendedBuffer = b.readBuffer(10);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Strings
|
|
101
145
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
console.log(buffer.readInt32LE()); // 789
|
|
146
|
+
```ts
|
|
147
|
+
const s = b.readString(5, "utf8");
|
|
105
148
|
```
|
|
149
|
+
|
|
150
|
+
### Integers
|
|
151
|
+
|
|
152
|
+
Variable-width (size **1…6** bytes):
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
const a = b.readIntBE(3);
|
|
156
|
+
const u = b.readUIntLE(4);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Fixed-width helpers:
|
|
160
|
+
|
|
161
|
+
- `readInt8`, `readUInt8`
|
|
162
|
+
- `readInt16BE`, `readInt16LE`, `readUInt16BE`, `readUInt16LE`
|
|
163
|
+
- `readInt32BE`, `readInt32LE`, `readUInt32BE`, `readUInt32LE`
|
|
164
|
+
|
|
165
|
+
### Floating point
|
|
166
|
+
|
|
167
|
+
- `readFloatBE`, `readFloatLE`
|
|
168
|
+
- `readDoubleBE`, `readDoubleLE`
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Pointer control (peeking / rewinding)
|
|
173
|
+
|
|
174
|
+
### Save pointer, read, then restore (peek)
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
const p = b.pointer;
|
|
178
|
+
const header = b.readUInt16BE();
|
|
179
|
+
|
|
180
|
+
// decide what to do...
|
|
181
|
+
b.setPointer(p); // rewind back to before header
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Move relative to current position
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
b.offset(4); // skip 4 bytes
|
|
188
|
+
b.offset(-2); // go back 2 bytes (must stay within 0…length)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
If you try to set the pointer outside `[0, length]`, it throws
|
|
192
|
+
`ExtendedBufferRangeError('POINTER_OUT_OF_RANGE')`.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Memory management
|
|
197
|
+
|
|
198
|
+
### Discard already-read data
|
|
199
|
+
|
|
200
|
+
If you continuously read from the buffer, you can drop the consumed prefix:
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
b.discardReadData();
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
This moves the internal start forward by the number of read bytes and resets `pointer` to `0`.
|
|
207
|
+
|
|
208
|
+
### Shrink free capacity (`gc()`)
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
b.gc();
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
`gc()` first discards read data, then may shrink the underlying native `Buffer`
|
|
215
|
+
when free space exceeds `capacityStep`.
|
|
216
|
+
|
|
217
|
+
### Reset everything
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
b.clean(); // alias for initExtendedBuffer()
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Errors
|
|
226
|
+
|
|
227
|
+
The library defines these error classes:
|
|
228
|
+
|
|
229
|
+
- `ExtendedBufferError`
|
|
230
|
+
- `ExtendedBufferTypeError`
|
|
231
|
+
- `ExtendedBufferRangeError`
|
|
232
|
+
|
|
233
|
+
Common error codes you may see:
|
|
234
|
+
|
|
235
|
+
- `SIZE_OUT_OF_RANGE` (reading more bytes than available)
|
|
236
|
+
- `POINTER_OUT_OF_RANGE` (setting pointer outside `0…length`)
|
|
237
|
+
- `INVALID_INTEGER_SIZE_VALUE_RANGE` (integer size not in `1…6`)
|
|
238
|
+
- `EXCEEDING_MAXIMUM_BUFFER_SIZE` (allocation exceeds Node’s `kMaxLength`)
|
|
239
|
+
- `INVALID_INSTANCE_STATE` (internal invariant check failed)
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Caveats
|
|
244
|
+
|
|
245
|
+
### Prepending (`unshift`) after reading
|
|
246
|
+
|
|
247
|
+
`unshift=true` prepends bytes by moving the internal start pointer, but the read pointer is **not adjusted** automatically.
|
|
248
|
+
If you prepend after consuming bytes, you may get surprising results (e.g., some previously read bytes can become readable again, or newly prepended bytes may be skipped).
|
|
249
|
+
|
|
250
|
+
A safe pattern is:
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
b.discardReadData();
|
|
254
|
+
b.writeUInt16BE(123, true);
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### `nodeGc()` is Node-specific
|
|
258
|
+
|
|
259
|
+
`nodeGc()` calls `global.gc()` if it exists. In Node.js it requires starting the process with `--expose-gc`.
|
|
260
|
+
In non-Node runtimes, `global` may not exist.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Reference: full public API (names)
|
|
265
|
+
|
|
266
|
+
Properties:
|
|
267
|
+
- `length`, `capacity`, `pointer`, `nativeBufferView`
|
|
268
|
+
|
|
269
|
+
Core:
|
|
270
|
+
- `initExtendedBuffer()`, `assertInstanceState()`, `clean()`
|
|
271
|
+
- `nativePointer()`, `getWritableSizeStart()`, `getWritableSizeEnd()`, `getWritableSize()`, `getReadableSize()`
|
|
272
|
+
- `allocStart(size)`, `allocEnd(size)`
|
|
273
|
+
- `writeNativeBuffer(buf, unshift?)`, `writeBuffer(bufOrEB, unshift?)`, `writeString(str, enc?, unshift?)`
|
|
274
|
+
- Pointer: `setPointer(p)`, `getPointer()`, `offset(n)`, `isReadable(size)`
|
|
275
|
+
- Maintenance: `discardReadData()`, `gc()`, `nodeGc()`
|
|
276
|
+
|
|
277
|
+
Numbers:
|
|
278
|
+
- Write: `writeIntBE/LE`, `writeUIntBE/LE`, `writeInt8`, `writeUInt8`,
|
|
279
|
+
`writeInt16BE/LE`, `writeUInt16BE/LE`, `writeInt32BE/LE`, `writeUInt32BE/LE`,
|
|
280
|
+
`writeFloatBE/LE`, `writeDoubleBE/LE`
|
|
281
|
+
- Read: `readBuffer`, `readString`,
|
|
282
|
+
`readIntBE/LE`, `readUIntBE/LE`, `readInt8`, `readUInt8`,
|
|
283
|
+
`readInt16BE/LE`, `readUInt16BE/LE`, `readInt32BE/LE`, `readUInt32BE/LE`,
|
|
284
|
+
`readFloatBE/LE`, `readDoubleBE/LE`
|
package/dist/ExtendedBuffer.d.ts
CHANGED
|
@@ -1,81 +1,76 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ExtendedBufferOptions } from './ExtendedBufferOptions';
|
|
2
|
+
import type { ExtendedBufferOptions } from './ExtendedBufferOptions';
|
|
3
3
|
export declare class ExtendedBuffer {
|
|
4
|
-
_pointer: number;
|
|
5
|
-
_pointerEnd: number;
|
|
6
|
-
_pointerStart: number;
|
|
7
|
-
_nativeBuffer: Buffer;
|
|
8
|
-
|
|
4
|
+
protected _pointer: number;
|
|
5
|
+
protected _pointerEnd: number;
|
|
6
|
+
protected _pointerStart: number;
|
|
7
|
+
protected _nativeBuffer: Buffer;
|
|
8
|
+
protected readonly _capacity: number;
|
|
9
|
+
protected readonly _capacityStep: number;
|
|
9
10
|
constructor(options?: ExtendedBufferOptions);
|
|
10
|
-
|
|
11
|
-
static concat<T extends ExtendedBuffer>(this: new (options?: ExtendedBufferOptions) => T, list: ExtendedBuffer[], totalLength?: number): T;
|
|
12
|
-
static zigZagEncode32(value: number): number;
|
|
13
|
-
static zigZagDecode32(value: number): number;
|
|
11
|
+
protected createInstance(options?: ExtendedBufferOptions): this;
|
|
14
12
|
get length(): number;
|
|
15
|
-
get
|
|
16
|
-
get
|
|
17
|
-
|
|
13
|
+
get capacity(): number;
|
|
14
|
+
get pointer(): number;
|
|
15
|
+
get nativeBufferView(): Buffer;
|
|
16
|
+
initExtendedBuffer(): this;
|
|
17
|
+
assertInstanceState(): this;
|
|
18
18
|
clean(): this;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
allocStart(byteLength: number): this;
|
|
23
|
-
allocEnd(byteLength: number): this;
|
|
24
|
-
getReadableSize(): number;
|
|
19
|
+
nativePointer(): number;
|
|
20
|
+
getWritableSizeStart(): number;
|
|
21
|
+
getWritableSizeEnd(): number;
|
|
25
22
|
getWritableSize(): number;
|
|
26
|
-
|
|
23
|
+
allocStart(size: number): this;
|
|
24
|
+
allocEnd(size: number): this;
|
|
25
|
+
getReadableSize(): number;
|
|
26
|
+
writeNativeBuffer(buffer: Buffer, unshift?: boolean): this;
|
|
27
27
|
gc(): this;
|
|
28
|
+
discardReadData(): this;
|
|
28
29
|
nodeGc(): this;
|
|
29
30
|
setPointer(pointer: number): this;
|
|
30
31
|
getPointer(): number;
|
|
31
32
|
offset(offset: number): this;
|
|
32
|
-
isReadable(
|
|
33
|
-
isWritable(byteLength?: number): boolean;
|
|
34
|
-
toString(encoding?: string, start?: number, end?: number): string;
|
|
33
|
+
isReadable(size: number): boolean;
|
|
35
34
|
writeBuffer(value: Buffer | ExtendedBuffer, unshift?: boolean): this;
|
|
36
|
-
writeString(string: string, encoding?:
|
|
37
|
-
writeIntBE(value: number,
|
|
38
|
-
writeIntLE(value: number,
|
|
39
|
-
writeUIntBE(value: number,
|
|
40
|
-
writeUIntLE(value: number,
|
|
41
|
-
writeInt8(value: number, unshift?: boolean
|
|
42
|
-
writeUInt8(value: number, unshift?: boolean
|
|
43
|
-
writeInt16BE(value: number, unshift?: boolean
|
|
44
|
-
writeInt16LE(value: number, unshift?: boolean
|
|
45
|
-
writeUInt16BE(value: number, unshift?: boolean
|
|
46
|
-
writeUInt16LE(value: number, unshift?: boolean
|
|
47
|
-
writeInt32BE(value: number, unshift?: boolean
|
|
48
|
-
writeInt32LE(value: number, unshift?: boolean
|
|
49
|
-
writeUInt32BE(value: number, unshift?: boolean
|
|
50
|
-
writeUInt32LE(value: number, unshift?: boolean
|
|
51
|
-
writeFloatBE(value: number, unshift?: boolean
|
|
52
|
-
writeFloatLE(value: number, unshift?: boolean
|
|
53
|
-
writeDoubleBE(value: number, unshift?: boolean
|
|
54
|
-
writeDoubleLE(value: number, unshift?: boolean
|
|
55
|
-
writeVarInt32(value: number, unshift?: boolean): this;
|
|
35
|
+
writeString(string: string, encoding?: BufferEncoding, unshift?: boolean): this;
|
|
36
|
+
writeIntBE(value: number, size: number, unshift?: boolean): this;
|
|
37
|
+
writeIntLE(value: number, size: number, unshift?: boolean): this;
|
|
38
|
+
writeUIntBE(value: number, size: number, unshift?: boolean): this;
|
|
39
|
+
writeUIntLE(value: number, size: number, unshift?: boolean): this;
|
|
40
|
+
writeInt8(value: number, unshift?: boolean): this;
|
|
41
|
+
writeUInt8(value: number, unshift?: boolean): this;
|
|
42
|
+
writeInt16BE(value: number, unshift?: boolean): this;
|
|
43
|
+
writeInt16LE(value: number, unshift?: boolean): this;
|
|
44
|
+
writeUInt16BE(value: number, unshift?: boolean): this;
|
|
45
|
+
writeUInt16LE(value: number, unshift?: boolean): this;
|
|
46
|
+
writeInt32BE(value: number, unshift?: boolean): this;
|
|
47
|
+
writeInt32LE(value: number, unshift?: boolean): this;
|
|
48
|
+
writeUInt32BE(value: number, unshift?: boolean): this;
|
|
49
|
+
writeUInt32LE(value: number, unshift?: boolean): this;
|
|
50
|
+
writeFloatBE(value: number, unshift?: boolean): this;
|
|
51
|
+
writeFloatLE(value: number, unshift?: boolean): this;
|
|
52
|
+
writeDoubleBE(value: number, unshift?: boolean): this;
|
|
53
|
+
writeDoubleLE(value: number, unshift?: boolean): this;
|
|
56
54
|
readBuffer(size: number): this;
|
|
55
|
+
readBuffer(size: number, asNative: true): Buffer;
|
|
57
56
|
readBuffer(size: number, asNative: false, bufferOptions?: ExtendedBufferOptions): this;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
readDoubleBE(noAssert?: boolean): number;
|
|
78
|
-
readDoubleLE(noAssert?: boolean): number;
|
|
79
|
-
readVarInt32(): number;
|
|
80
|
-
isReadableVarInt32(): boolean;
|
|
57
|
+
readString(size: number, encoding?: BufferEncoding): string;
|
|
58
|
+
readIntBE(size: number): number;
|
|
59
|
+
readIntLE(size: number): number;
|
|
60
|
+
readUIntBE(size: number): number;
|
|
61
|
+
readUIntLE(size: number): number;
|
|
62
|
+
readInt8(): number;
|
|
63
|
+
readUInt8(): number;
|
|
64
|
+
readInt16BE(): number;
|
|
65
|
+
readInt16LE(): number;
|
|
66
|
+
readUInt16BE(): number;
|
|
67
|
+
readUInt16LE(): number;
|
|
68
|
+
readInt32BE(): number;
|
|
69
|
+
readInt32LE(): number;
|
|
70
|
+
readUInt32BE(): number;
|
|
71
|
+
readUInt32LE(): number;
|
|
72
|
+
readFloatBE(): number;
|
|
73
|
+
readFloatLE(): number;
|
|
74
|
+
readDoubleBE(): number;
|
|
75
|
+
readDoubleLE(): number;
|
|
81
76
|
}
|