bireader 3.1.15 → 4.0.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 +428 -210
- package/_test_reader.cjs +38 -0
- package/_test_writer.mjs +8 -0
- package/dist/index.browser.d.ts +8628 -1434
- package/dist/index.browser.js +16255 -3816
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.d.ts +3060 -2019
- package/dist/index.cjs.js +8583 -6901
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3060 -2019
- package/dist/index.esm.d.ts +3060 -2019
- package/dist/index.esm.js +8581 -6902
- package/dist/index.esm.js.map +1 -1
- package/package.json +21 -4
- package/rollup.config.mjs +81 -0
package/README.md
CHANGED
|
@@ -1,8 +1,35 @@
|
|
|
1
1
|
# BiReader / BiWriter
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
**A fast, dual-mode (sync / async) file / buffer handler with byte + bit-level access.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Feature rich binary reader ***and writer*** that keeps track of your position to quickly create file structures. Perfect for binary parsers, editors, game save files, custom formats, or any situation where you need random access + structural modifications without loading the entire file into memory. Includes shared naming conventions, programmable inputs and advanced math for easy data conversions on low level parsing. Accepts `Uint8Array`, `Buffer` or a `filePath`. Includes Sync and [Async](#async) verions.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
- **Dual mode**: Sync or Async file reader (`r+` / `r`) on disk **or** pure in-memory `Buffer` or `Uint8Array`
|
|
12
|
+
- **Chunked async loading** – configurable `windowSize` (default 4 KiB)
|
|
13
|
+
→ Set `windowSize: 0` to load the entire file in **one** async read
|
|
14
|
+
- **Byte cursor**: Track and change location with `offset` +Bit cursor `bitOffset`
|
|
15
|
+
- **Full bitfield support** – `readBit()` / `writeBit()` with:
|
|
16
|
+
- signed / unsigned
|
|
17
|
+
- big-endian (`'be'`) or little-endian (`'le'`)
|
|
18
|
+
- any alignment (bits can start anywhere)
|
|
19
|
+
- **Structural edits**:
|
|
20
|
+
- `insert()` – insert data anywhere
|
|
21
|
+
- `remove()` – delete data and **return** the removed chunk
|
|
22
|
+
- `trim()` – shrink (returns removed tail)
|
|
23
|
+
- `push()` – Grows start
|
|
24
|
+
- **Expandable files** with smart `growthIncrement` (default 1 MiB) to minimize syscalls
|
|
25
|
+
- `return()` – flushes changes and returns the complete current content
|
|
26
|
+
- `readonly` and `strict` modes (for limiting `growthIncrement`)
|
|
27
|
+
- In `async` class, all operations automatically wait for required chunks
|
|
28
|
+
- Zero dependencies (only `fs` & `fs/promises` in Node)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## ✅ Supported data types
|
|
6
33
|
|
|
7
34
|
- [Bitfields](#bit-field) ([u]bit{1-32}{le|be}) 1-32 bit signed or unsigned value in big or little endian order
|
|
8
35
|
- [Bytes](#byte) ([u]int8, byte) 8 bit signed or unsigned value
|
|
@@ -12,24 +39,32 @@ Supported data types:
|
|
|
12
39
|
- [Floats](#float) (float{le|be}) 32 bit decimal value in big or little endian
|
|
13
40
|
- [Quadwords](#quadword) ([u]int64, quad, bigint{le|be}) 64 bit signed or unsigned in big or little endian
|
|
14
41
|
- [Double Floats](#double-float) (doublefloat, dfloat{le|be}) 64 bit decimal value in big or little endian
|
|
15
|
-
- [Strings](#strings) (string) Fixed and non-fixed length, UTF, pascal, wide pascal. Includes all
|
|
42
|
+
- [Strings](#strings) (string) Fixed and non-fixed length, UTF, pascal, wide pascal. Includes all `TextEncoder` types
|
|
16
43
|
|
|
17
|
-
## What's New?
|
|
44
|
+
## ⭐ What's New?
|
|
45
|
+
|
|
46
|
+
### v4
|
|
47
|
+
* Added `BiReaderAsync` and `BiWriterAsync`. See [Async](#async) classes.
|
|
48
|
+
* Uses `DataView` read and write functions when possible for more efficient code (previous code is now fallback).
|
|
49
|
+
* Added support for `UTF-32` and `Double Wide Pascal` (32 bit) strings.
|
|
50
|
+
* Large code clean up with included test.
|
|
51
|
+
* Marked deprecated `BiReaderStream` and `BiWriterStream` as functionality was moved to `BiReader` and `BiWriter` for file reading (Node only).
|
|
52
|
+
* Values for writes are now clamped to bit size and don't throw errors.
|
|
18
53
|
|
|
19
54
|
### v3
|
|
20
|
-
* Added
|
|
55
|
+
* Added `enforceBigInt` option for always returning a `BigInt` type on 64 bit reads, otherwise will return a `number` if integer safe.
|
|
21
56
|
* Added Browser, Node CommonJS and Node ESM modules.
|
|
22
|
-
* Added new
|
|
23
|
-
* Added
|
|
24
|
-
* Added setter
|
|
25
|
-
* Added better options for extending array buffer when writing data with
|
|
57
|
+
* Added new `BiReaderStream` and `BiWriterStream` (Node only).
|
|
58
|
+
* Added `.deleteFile()` and `.renameFile(filePath)`.
|
|
59
|
+
* Added setter `.strSettings` for use with `.str` for easier coding.
|
|
60
|
+
* Added better options for extending array buffer when writing data with `growthIncrement`.
|
|
26
61
|
* Consolidated all options argument into single object when creating class.
|
|
27
|
-
* Removed deprecated
|
|
28
|
-
* Fixed standalone
|
|
62
|
+
* Removed deprecated `bireader` and `biwriter` classes.
|
|
63
|
+
* Fixed standalone `hexdump` function.
|
|
29
64
|
|
|
30
65
|
### v2
|
|
31
|
-
* Created new
|
|
32
|
-
* Marked
|
|
66
|
+
* Created new `BiReader` and `BiWriter` classes with *get* and *set* functions for easier coding.
|
|
67
|
+
* Marked `bireader` and `biwriter` as deprecated. Set to be removed next update.
|
|
33
68
|
|
|
34
69
|
### v1
|
|
35
70
|
* Included math functions and value searches.
|
|
@@ -37,11 +72,123 @@ Supported data types:
|
|
|
37
72
|
|
|
38
73
|
## Installation
|
|
39
74
|
|
|
40
|
-
|
|
75
|
+
``npm install bireader``
|
|
76
|
+
|
|
77
|
+
Provides both CommonJS and ES modules. Works in Browser, Node.js (CJS + ESM), and provides zero-dependency binaries.
|
|
78
|
+
|
|
79
|
+
## Quick Start – The 4 Classes
|
|
80
|
+
|
|
81
|
+
| Class | Use Case | Style | Best For |
|
|
82
|
+
| --- | --- | --- | --- |
|
|
83
|
+
|`BiReader` | Most parsing tasks | Sync | Buffers + normal files |
|
|
84
|
+
|`BiWriter` | Creating / editing binary files | Sync | In-memory + normal files |
|
|
85
|
+
|`BiReaderAsync`| Huge files (> 2–4 GB) | Async | Very large files |
|
|
86
|
+
|`BiWriterAsync`| Writing huge files without OOM | Async | Streaming / large output |
|
|
87
|
+
|
|
88
|
+
### 1. BiReader + BiWriter (Sync – Recommended for 99% of use cases)
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
import { BiReader, BiWriter } from 'bireader';
|
|
92
|
+
|
|
93
|
+
// === Reading from Buffer / Uint8Array ===
|
|
94
|
+
const data = new Uint8Array([0x01, 0x02, 0x03, 0x04 /* ... */]);
|
|
95
|
+
const br = new BiReader(data);
|
|
96
|
+
|
|
97
|
+
console.log(br.uint32le); // auto-advances cursor
|
|
98
|
+
console.log(br.halffloatle);
|
|
99
|
+
console.log(br.readString(10)); // or use .pstring2le, .widestring, etc.
|
|
100
|
+
|
|
101
|
+
// === Writing (auto-grows) ===
|
|
102
|
+
const bw = new BiWriter();
|
|
103
|
+
bw.uint32le = 0xCAFEBABE;
|
|
104
|
+
bw.halffloatle = 3.1416;
|
|
105
|
+
bw.pstring2le("Hello World");
|
|
106
|
+
bw.writeBit(0b101, 3); // bit-level control
|
|
107
|
+
|
|
108
|
+
const finalBuffer = bw.data; // or bw.toBuffer()
|
|
109
|
+
```
|
|
110
|
+
**Node.js file support (still sync)**
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
const brFile = new BiReader('huge-but-not-gigantic.bin'); // accepts filePath
|
|
114
|
+
console.log(brFile.int64le);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 2. BiReaderAsync + BiWriterAsync (Async – for huge files)
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
import { BiReaderAsync, BiWriterAsync } from 'bireader';
|
|
121
|
+
|
|
122
|
+
// === Async Reader (random access, no full load into RAM) ===
|
|
123
|
+
const brAsync = await BiReaderAsync.create('massive-50gb-file.bin');
|
|
124
|
+
|
|
125
|
+
await brAsync.seek(1024 * 1024 * 1024); // jump to 1 GB mark
|
|
126
|
+
const magic = await brAsync.str(); // or .uint32le, .halffloatle, etc.
|
|
127
|
+
const value = await brAsync.readUint64(); // all methods are now async
|
|
128
|
+
|
|
129
|
+
await brAsync.close();
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Async Writer**
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
const bwAsync = await BiWriterAsync.create('output-huge.bin');
|
|
136
|
+
|
|
137
|
+
await bwAsync.writeUint32(0xDEADBEEF);
|
|
138
|
+
await bwAsync.halffloatle(1.618);
|
|
139
|
+
await bwAsync.writeString("Header data", { stringType: 'utf8', terminateValue: 0 });
|
|
140
|
+
|
|
141
|
+
await bwAsync.close(); // flushes everything
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Important: `BiReaderAsync` / `BiWriterAsync` are Node.js only (they use `fs/promises`).**
|
|
145
|
+
|
|
146
|
+
### 3. Bit-Field Example (works on all 4 classes)
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
const br = new BiReader(myData);
|
|
150
|
+
br.goto(0x100);
|
|
151
|
+
|
|
152
|
+
// Bit-level presets (auto-advance cursor)
|
|
153
|
+
console.log(br.ubit4); // 4 bits
|
|
154
|
+
console.log(br.bit8); // signed 8 bits
|
|
155
|
+
console.log(br.ubit24be); // 24 bits big-endian
|
|
41
156
|
|
|
42
|
-
|
|
157
|
+
// Manual bit control
|
|
158
|
+
br.insetBit = 3;
|
|
159
|
+
console.log(br.readBit(5)); // read any number of bits
|
|
160
|
+
br.writeBit(0b10110, 5); // write any number of bits
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 4. String Handling (all variants)
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
const bw = new BiWriter();
|
|
167
|
+
bw.strSettings = { length: 8, stringType: 'utf16le', terminateValue: 0 };
|
|
168
|
+
|
|
169
|
+
bw.str = "Hello 🌍"; // uses current strSettings
|
|
170
|
+
bw.pstring2le("Pascal string");
|
|
171
|
+
bw.widestring("UTF-16 wide string");
|
|
43
172
|
|
|
44
|
-
|
|
173
|
+
const br = new BiReader(bw.data);
|
|
174
|
+
console.log(br.cstring()); // null-terminated
|
|
175
|
+
console.log(br.pstring4be());
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 5. Math Helpers (XOR, shifts, etc.)
|
|
179
|
+
|
|
180
|
+
```javascript
|
|
181
|
+
const bw = new BiWriter(data);
|
|
182
|
+
bw.xor(0xAA); // XOR entire buffer with key
|
|
183
|
+
bw.lShift(1, 0, 8); // left-shift first 8 bytes by 1 bit
|
|
184
|
+
bw.and(0x0F, 0, 4); // AND bytes 0-3 with 0x0F
|
|
185
|
+
console.log(bw.toHex()); // nice hexdump helper
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 6. Real-World Complete Example (WebP parser)
|
|
189
|
+
|
|
190
|
+
<details>
|
|
191
|
+
<summary>Click to expand</summary>
|
|
45
192
|
|
|
46
193
|
Import the reader or writer. Create a new parser with the data and start parsing.
|
|
47
194
|
|
|
@@ -51,7 +198,7 @@ Includes presents for quick parsing or programmable functions (examples below).
|
|
|
51
198
|
import {BiReader, BiWriter} from 'bireader';
|
|
52
199
|
|
|
53
200
|
// read example - parse a webp file
|
|
54
|
-
function
|
|
201
|
+
function parseWebp(data){
|
|
55
202
|
const br = new BiReader(data);
|
|
56
203
|
br.strSettings = {length: 4};
|
|
57
204
|
br.hexdump({suppressUnicode:true}); // console.log data as hex
|
|
@@ -71,18 +218,18 @@ function parse_webp(data){
|
|
|
71
218
|
// 000b0 77 44 40 94 6d 25 6c 74 91 a8 88 86 58 9b da 6e wD@.m%lt....X..n
|
|
72
219
|
|
|
73
220
|
const header = {};
|
|
74
|
-
header.magic = br.str;
|
|
75
|
-
header.size = br.uint32le;
|
|
76
|
-
header.fileSize = header.size + 8;
|
|
77
|
-
header.payload = br.str;
|
|
78
|
-
header.format = br.str;
|
|
79
|
-
header.formatChunkSize = br.uint32le;
|
|
221
|
+
header.magic = br.str; // RIFF
|
|
222
|
+
header.size = br.uint32le; // 15000
|
|
223
|
+
header.fileSize = header.size + 8; // 15008
|
|
224
|
+
header.payload = br.str; // WEBP
|
|
225
|
+
header.format = br.str; // VP8X
|
|
226
|
+
header.formatChunkSize = br.uint32le; // 10
|
|
80
227
|
switch (header.format){
|
|
81
228
|
case "VP8 ":
|
|
82
229
|
header.formatType = "Lossy";
|
|
83
|
-
var
|
|
230
|
+
var readSize = 0;
|
|
84
231
|
header.frame_tag = br.ubit24;
|
|
85
|
-
|
|
232
|
+
readSize += 3;
|
|
86
233
|
header.key_frame = header.frame_tag & 0x1;
|
|
87
234
|
header.version = (header.frame_tag >> 1) & 0x7;
|
|
88
235
|
header.show_frame = (header.frame_tag >> 4) & 0x1;
|
|
@@ -94,22 +241,22 @@ function parse_webp(data){
|
|
|
94
241
|
header.vertical_size_code = br.ubit16;
|
|
95
242
|
header.height = header.vertical_size_code & 0x3FFF;
|
|
96
243
|
header.vertical_scale = header.vertical_size_code >> 14;
|
|
97
|
-
|
|
98
|
-
header.VP8data = br.extract(header.formatChunkSize -
|
|
244
|
+
readSize += 7;
|
|
245
|
+
header.VP8data = br.extract(header.formatChunkSize - readSize, true);
|
|
99
246
|
break;
|
|
100
247
|
case "VP8L":
|
|
101
248
|
header.formatType = "Lossless";
|
|
102
|
-
var
|
|
249
|
+
var readSize = 0;
|
|
103
250
|
header.signature = br.ubyte; // should be 47
|
|
104
|
-
|
|
251
|
+
readSize += 1;
|
|
105
252
|
header.readWidth = br.ubit14;
|
|
106
253
|
header.width = header.readWidth+1;
|
|
107
254
|
header.readHeight = br.ubit14;
|
|
108
255
|
header.height = header.readHeight+1;
|
|
109
256
|
header.alpha_is_used = br.bit1;
|
|
110
257
|
header.version_number = br.ubit3;
|
|
111
|
-
|
|
112
|
-
header.VP8Ldata = br.extract(header.formatChunkSize -
|
|
258
|
+
readSize += 4;
|
|
259
|
+
header.VP8Ldata = br.extract(header.formatChunkSize - readSize, true);
|
|
113
260
|
break;
|
|
114
261
|
case "VP8X":
|
|
115
262
|
header.formatType = "Extended";
|
|
@@ -293,15 +440,18 @@ function write_webp(data){
|
|
|
293
440
|
return bw.return();
|
|
294
441
|
}
|
|
295
442
|
```
|
|
443
|
+
</details>
|
|
296
444
|
|
|
297
445
|
## Common Functions
|
|
298
446
|
|
|
299
447
|
Common functions for setup, movement, manipulation and math shared by both.
|
|
300
448
|
|
|
449
|
+
Naming is shared across sync and async classes.
|
|
450
|
+
|
|
301
451
|
<table>
|
|
302
452
|
<thead>
|
|
303
453
|
<tr>
|
|
304
|
-
<th align="center" colspan="2">
|
|
454
|
+
<th align="center" colspan="2">Methods</th>
|
|
305
455
|
<th align="center">Params (bold requires)</th>
|
|
306
456
|
<th align="left">Desc</th>
|
|
307
457
|
</tr>
|
|
@@ -311,78 +461,118 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
311
461
|
<th align="center" colspan="4"><i>Setup</i></th>
|
|
312
462
|
<tr>
|
|
313
463
|
<tr>
|
|
314
|
-
<td>
|
|
315
|
-
<td>new BiReader(<b>
|
|
316
|
-
<td
|
|
464
|
+
<td>Class</td>
|
|
465
|
+
<td>new BiReader(<b>dataOrPath</b>, {byteOffset, bitOffset, endianess, strict, growthIncrement, enforceBigInt, readOnly})</td>
|
|
466
|
+
<td rowspan="2"><b>dataOrPath:</b> string path or Buffer or Uint8Array</b><br><b>byteOffset:</b> byte offset (default <code>0</code>)<br><b>bitOffset:</b> bit offset (overides <code>byteOffset</code>) (default <code>0</code>)<br><b>endianess:</b> endian big or little (default <code>little</code>)<br><b>strict:</b> strict mode restrict extending initially supplied data (default <code>true</code> for reader, <code>false</code> for writer)<br><b>growthIncrement:</b> default extended Buffer size (default <code>1 MiB</code>)<br><b>enforceBigInt:</b> always return <code>bigint</code> values on 64 bit reads (default <code>false</code>)<br><b>readOnly:</b> read only Buffer or file (default <code>true</code> in writer)
|
|
317
467
|
</td>
|
|
318
|
-
<td rowspan="2">Start with new Constructor.<br><br><b>Note:</b> Supplied data can always be found with <b>.data</b>.<br><br><b>
|
|
468
|
+
<td rowspan="2">Start with new Constructor.<br><br><b>File Note:</b> When writing to a file, you must use close() when finished, or commit() to make sure changes are committed.<br><br><b>Data Note:</b> Supplied data can always be found with <b>.data</b>.<br><br><b>Supplied data note:</b> While BiWriter can be created with a 0 length Uint8Array or Buffer, the default <code>growthIncrement</code> will prevent a new array created on each operation (leading to a degraded performance). It's best to supply a larger than needed buffer when creating the Writer and use <b>.trim()</b> after you're finished.</td>
|
|
469
|
+
</tr>
|
|
470
|
+
<tr>
|
|
471
|
+
<td>Class</td>
|
|
472
|
+
<td>new BiWriter(<b>dataOrPath</b>, {byteOffset, bitOffset, endianess, strict, growthIncrement, enforceBigInt, writeable})</td>
|
|
473
|
+
</tr>
|
|
474
|
+
<th align="center" colspan="4"><i>File Mode</i></th>
|
|
475
|
+
<tr>
|
|
476
|
+
<td>Function</td>
|
|
477
|
+
<td>open()
|
|
478
|
+
<td align="center"><b>none</td>
|
|
479
|
+
<td>Opens file for reading / writing. Happens before any operations.</td>
|
|
319
480
|
</tr>
|
|
320
481
|
<tr>
|
|
321
|
-
<td>
|
|
322
|
-
<td>
|
|
482
|
+
<td>Function</td>
|
|
483
|
+
<td>close()
|
|
484
|
+
<td align="center"><b>none</td>
|
|
485
|
+
<td>Closes file after reading / writing. Note: Commits any edits to the file.</td>
|
|
486
|
+
</tr>
|
|
487
|
+
<tr>
|
|
488
|
+
<td>Function</td>
|
|
489
|
+
<td>commit()
|
|
490
|
+
<td align="center"><b>none</td>
|
|
491
|
+
<td>Commits any edits to data to file.</td>
|
|
323
492
|
</tr>
|
|
324
493
|
<tr>
|
|
325
|
-
<td>
|
|
494
|
+
<td>Function</td>
|
|
495
|
+
<td>writeMode(<b>mode</b>)</td>
|
|
496
|
+
<td align="center" >boolean</td>
|
|
497
|
+
<td>Set strict and readOnly to true or false. Will close and reopen file in file mode.</td>
|
|
498
|
+
</tr>
|
|
499
|
+
<tr>
|
|
500
|
+
<td>Function</td>
|
|
501
|
+
<td>renameFile(<b>newFilePath</b>)
|
|
502
|
+
<td align="center"><b>Full path to file to rename.</td>
|
|
503
|
+
<td>Renames the file on the file system, keeps read / write position.<br/><br/><b>Note: This is permanent.</b></td>
|
|
504
|
+
</tr>
|
|
505
|
+
<tr>
|
|
506
|
+
<td>Function</td>
|
|
507
|
+
<td>deleteFile()
|
|
508
|
+
<td align="center"><b>none</td>
|
|
509
|
+
<td>Unlinks the file from the file system.<br/><br/><b>Note: This is permanent, it doesn't send the file to the recycling bin for recovery.</b></td>
|
|
510
|
+
</tr>
|
|
511
|
+
<th align="center" colspan="4"><i>Endian</i></th>
|
|
512
|
+
<tr>
|
|
513
|
+
<td>Function</td>
|
|
326
514
|
<td>endianness(<b>"big" | "little"</b>)</td>
|
|
327
|
-
<td align="center" rowspan="2"><
|
|
515
|
+
<td align="center" rowspan="2"><code>big</code> or <code>little</code> (default <code>little</code>)</td>
|
|
328
516
|
<td rowspan="2">Set or change Endian. Can be changed at any time.</td>
|
|
329
517
|
</tr>
|
|
330
518
|
<tr>
|
|
331
519
|
<td>Presets</td>
|
|
332
520
|
<td>bigEndian(), big(), be()<br>littleEndian(), little(), le()</td>
|
|
333
521
|
</tr>
|
|
522
|
+
<th align="center" colspan="4"><i>Size</i></th>
|
|
334
523
|
<tr>
|
|
335
|
-
<td>
|
|
336
|
-
<td>
|
|
524
|
+
<td>get</td>
|
|
525
|
+
<td>size</td>
|
|
337
526
|
<td align="center" rowspan="2">None</td>
|
|
338
527
|
<td rowspan="2">Gets the current buffer size in bytes.</td>
|
|
339
528
|
</tr>
|
|
340
529
|
<tr>
|
|
341
530
|
<td>Aliases</td>
|
|
342
|
-
<td>
|
|
531
|
+
<td>length, len, fileSize</td>
|
|
343
532
|
</tr>
|
|
344
533
|
<tr>
|
|
345
|
-
<td>
|
|
346
|
-
<td>
|
|
534
|
+
<td>get</td>
|
|
535
|
+
<td>sizeBits</td>
|
|
347
536
|
<td align="center" rowspan="2">None</td>
|
|
348
537
|
<td rowspan="2">Gets the current buffer size in bits.</td>
|
|
349
538
|
</tr>
|
|
350
539
|
<tr>
|
|
351
540
|
<td>Aliases</td>
|
|
352
|
-
<td>
|
|
541
|
+
<td>lengthBits, lenBits, fileSizeBits</td>
|
|
353
542
|
</tr>
|
|
543
|
+
<th align="center" colspan="4"><i>Position</i></th>
|
|
354
544
|
<tr>
|
|
355
|
-
<td>
|
|
356
|
-
<td>
|
|
545
|
+
<td>get</td>
|
|
546
|
+
<td>offset</td>
|
|
357
547
|
<td align="center" rowspan="2">None</td>
|
|
358
548
|
<td rowspan="2">Gets current byte position.</td>
|
|
359
549
|
</tr>
|
|
360
550
|
<tr>
|
|
361
551
|
<td>Aliases</td>
|
|
362
|
-
<td>off, FTell,
|
|
552
|
+
<td>byteOffset, off, FTell, saveOffset</td>
|
|
363
553
|
</tr>
|
|
364
554
|
<tr>
|
|
365
|
-
<td>
|
|
366
|
-
<td>
|
|
555
|
+
<td>get</td>
|
|
556
|
+
<td>bitOffset</td>
|
|
367
557
|
<td align="center" rowspan="2">None</td>
|
|
368
|
-
<td rowspan="2">Gets current
|
|
558
|
+
<td rowspan="2">Gets current bit position.</td>
|
|
369
559
|
</tr>
|
|
370
560
|
<tr>
|
|
371
561
|
<td>Aliases</td>
|
|
372
|
-
<td>
|
|
562
|
+
<td>offsetBits, offBits, FTellBits, saveBitOffset</td>
|
|
373
563
|
</tr>
|
|
374
564
|
<tr>
|
|
375
|
-
<td>
|
|
376
|
-
<td>
|
|
565
|
+
<td>get</td>
|
|
566
|
+
<td>insetBit</td>
|
|
377
567
|
<td align="center" rowspan="2">None</td>
|
|
378
|
-
<td rowspan="2">Gets current
|
|
568
|
+
<td rowspan="2">Gets current byte's bit position (0-7).</td>
|
|
379
569
|
</tr>
|
|
380
570
|
<tr>
|
|
381
571
|
<td>Aliases</td>
|
|
382
|
-
<td>
|
|
572
|
+
<td>inBit, bitTell, saveInsetBit</td>
|
|
383
573
|
</tr>
|
|
384
574
|
<tr>
|
|
385
|
-
<td>
|
|
575
|
+
<td>get</td>
|
|
386
576
|
<td>remain</td>
|
|
387
577
|
<td align="center" rowspan="2">None</td>
|
|
388
578
|
<td rowspan="2">Size in bytes of current read position to the end.</td>
|
|
@@ -392,17 +582,17 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
392
582
|
<td>FEoF</td>
|
|
393
583
|
</tr>
|
|
394
584
|
<tr>
|
|
395
|
-
<td>
|
|
396
|
-
<td>
|
|
585
|
+
<td>get</td>
|
|
586
|
+
<td>remainBits</td>
|
|
397
587
|
<td align="center" rowspan="2">None</td>
|
|
398
588
|
<td rowspan="2">Size in bits of current read position to the end.</td>
|
|
399
589
|
</tr>
|
|
400
590
|
<tr>
|
|
401
591
|
<td>Aliases</td>
|
|
402
|
-
<td>
|
|
592
|
+
<td>FEoFBits</td>
|
|
403
593
|
</tr>
|
|
404
594
|
<tr>
|
|
405
|
-
<td>
|
|
595
|
+
<td>get</td>
|
|
406
596
|
<td>getLine</td>
|
|
407
597
|
<td align="center" rowspan="2">None</td>
|
|
408
598
|
<td rowspan="2">Row line of the file (16 bytes per row).</td>
|
|
@@ -411,126 +601,130 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
411
601
|
<td>Aliases</td>
|
|
412
602
|
<td>row</td>
|
|
413
603
|
</tr>
|
|
604
|
+
<th align="center" colspan="4"><i>Finishing</i></th>
|
|
414
605
|
<tr>
|
|
415
|
-
<td>
|
|
416
|
-
<td>get</td>
|
|
606
|
+
<td>Function</td>
|
|
607
|
+
<td>get()</td>
|
|
417
608
|
<td align="center" rowspan="2">None</td>
|
|
418
|
-
<td rowspan="2">Returns supplied data. <b>Note:</b> Will use
|
|
609
|
+
<td rowspan="2">Returns supplied data. <b>Note:</b> Will use <code>.trim()</code> function if <code>growthIncrement</code> extended the buffer (removes all data after current position). Use <code>.data</code> if you want the full padded data buffer.</td>
|
|
419
610
|
</tr>
|
|
420
611
|
<tr>
|
|
421
612
|
<td>Aliases</td>
|
|
422
|
-
<td>return</td>
|
|
613
|
+
<td>return(), getFullBuffer()</td>
|
|
423
614
|
</tr>
|
|
424
615
|
<tr>
|
|
425
|
-
<td>
|
|
616
|
+
<td>Function</td>
|
|
617
|
+
<td>end()</td>
|
|
618
|
+
<td align="center" rowspan="2">None</td>
|
|
619
|
+
<td rowspan="2">Removes supplied data.</td>
|
|
620
|
+
</tr>
|
|
621
|
+
<tr>
|
|
622
|
+
<td>Aliases</td>
|
|
623
|
+
<td>close(), done(), finished()</td>
|
|
624
|
+
</tr>
|
|
625
|
+
<tr>
|
|
626
|
+
<td>get</td>
|
|
426
627
|
<td>data</td>
|
|
427
628
|
<td align="center">None</td>
|
|
428
629
|
<td >Returns full current buffer data.</td>
|
|
429
630
|
</tr>
|
|
631
|
+
<th align="center" colspan="4"><i>Hex Dump</i></th>
|
|
430
632
|
<tr>
|
|
431
|
-
<td>
|
|
633
|
+
<td>Function</td>
|
|
432
634
|
<td>hexdump({length, startByte, suppressUnicode})</td>
|
|
433
635
|
<td align="center">Length of dump in bytes (default 192), byte position to start the dump (default current byte position), Suppress unicode character preview for cleaner columns (default false)</td>
|
|
434
636
|
<td >Console logs data. Will trigger on error unless turned off (see below)</td>
|
|
435
637
|
</tr>
|
|
436
638
|
<tr>
|
|
437
|
-
<td>
|
|
639
|
+
<td>Function</td>
|
|
438
640
|
<td>errorDumpOff()</td>
|
|
439
641
|
<td align="center">None</td>
|
|
440
|
-
<td >Does not hexdump on error (default
|
|
642
|
+
<td >Does not hexdump on error (default)</td>
|
|
441
643
|
</tr>
|
|
442
644
|
<tr>
|
|
443
|
-
<td>
|
|
645
|
+
<td>Function</td>
|
|
444
646
|
<td>errorDumpOn()</td>
|
|
445
647
|
<td align="center">None</td>
|
|
446
|
-
<td >
|
|
648
|
+
<td >Turns on hexdump on error</td>
|
|
447
649
|
</tr>
|
|
650
|
+
<th align="center" colspan="4"><i>Strict</i></th>
|
|
448
651
|
<tr>
|
|
449
|
-
<td>
|
|
652
|
+
<td>Function</td>
|
|
450
653
|
<td>unrestrict()</td>
|
|
451
654
|
<td align="center">None</td>
|
|
452
655
|
<td>Sets strict mode to false, will extend array if data is outside of max size (<b>default true for reader, false for writer</b>)</td>
|
|
453
656
|
</tr>
|
|
454
657
|
<tr>
|
|
455
|
-
<td>
|
|
658
|
+
<td>Function</td>
|
|
456
659
|
<td>restrict()</td>
|
|
457
660
|
<td align="center">None</td>
|
|
458
661
|
<td>Sets strict mode to true, won't extend array if data is outside of max size (<b>default true for reader, false for writer</b>)</td>
|
|
459
662
|
</tr>
|
|
460
|
-
|
|
461
|
-
<td>Name</td>
|
|
462
|
-
<td>end()</td>
|
|
463
|
-
<td align="center" rowspan="2">None</td>
|
|
464
|
-
<td rowspan="2">Removes supplied data.</td>
|
|
465
|
-
</tr>
|
|
466
|
-
<tr>
|
|
467
|
-
<td>Aliases</td>
|
|
468
|
-
<td>close(), done(), finished()</td>
|
|
469
|
-
</tr>
|
|
663
|
+
|
|
470
664
|
<th align="center" colspan="4"><i>Search</i></th>
|
|
471
665
|
<tr>
|
|
472
|
-
<td>
|
|
666
|
+
<td>Function</td>
|
|
473
667
|
<td>findString(<b>value</b>, unsigned, endian)</td>
|
|
474
668
|
<td align="center">Searches for byte position of string from current read position.</td>
|
|
475
669
|
<td ><b>Note:</b> Does not change current read position.</td>
|
|
476
670
|
</tr>
|
|
477
671
|
<tr>
|
|
478
|
-
<td>
|
|
672
|
+
<td>Function</td>
|
|
479
673
|
<td>findByte(<b>value</b>, unsigned, endian)</td>
|
|
480
674
|
<td align="center">Searches for byte value (can be signed or unsigned) position from current read position.</td>
|
|
481
675
|
<td ><b>Note:</b> Does not change current read position.</td>
|
|
482
676
|
</tr>
|
|
483
677
|
<tr>
|
|
484
|
-
<td>
|
|
678
|
+
<td>Function</td>
|
|
485
679
|
<td>findShort(<b>value</b>, unsigned, endian)</td>
|
|
486
680
|
<td align="center">Searches for short value (can be signed or unsigned) position from current read position.</td>
|
|
487
681
|
<td ><b>Note:</b> Does not change current read position.</td>
|
|
488
682
|
</tr>
|
|
489
683
|
<tr>
|
|
490
|
-
<td>
|
|
684
|
+
<td>Function</td>
|
|
491
685
|
<td>findInt(<b>value</b>, unsigned, endian)</td>
|
|
492
686
|
<td align="center">Searches for integer value (can be signed or unsigned) position from current read position.</td>
|
|
493
687
|
<td ><b>Note:</b> Does not change current read position.</td>
|
|
494
688
|
</tr>
|
|
495
689
|
<tr>
|
|
496
|
-
<td>
|
|
690
|
+
<td>Function</td>
|
|
497
691
|
<td>findInt64(<b>value</b>, unsigned, endian)</td>
|
|
498
692
|
<td align="center">Searches for 64 bit position from current read position.</td>
|
|
499
693
|
<td ><b>Note:</b> Does not change current read position.</td>
|
|
500
694
|
</tr>
|
|
501
695
|
<tr>
|
|
502
|
-
<td>
|
|
696
|
+
<td>Function</td>
|
|
503
697
|
<td>findHalfFloat(<b>value</b>, endian)</td>
|
|
504
698
|
<td align="center">Searches for half float value position from current read position.</td>
|
|
505
699
|
<td ><b>Note:</b> Does not change current read position.</td>
|
|
506
700
|
</tr>
|
|
507
701
|
<tr>
|
|
508
|
-
<td>
|
|
702
|
+
<td>Function</td>
|
|
509
703
|
<td>findFloat(<b>value</b>, endian)</td>
|
|
510
704
|
<td align="center">Searches for float value position from current read position.</td>
|
|
511
705
|
<td ><b>Note:</b> Does not change current read position.</td>
|
|
512
706
|
</tr>
|
|
513
707
|
<tr>
|
|
514
|
-
<td>
|
|
708
|
+
<td>Function</td>
|
|
515
709
|
<td>findDoubleFloat(<b>value</b>, endian)</td>
|
|
516
710
|
<td align="center">Searches for double float value position from current read position.</td>
|
|
517
711
|
<td ><b>Note:</b> Does not change current read position.</td>
|
|
518
712
|
</tr>
|
|
519
713
|
<th align="center" colspan="4"><i>Movement</i></th>
|
|
520
714
|
<tr>
|
|
521
|
-
<td>
|
|
715
|
+
<td>Function</td>
|
|
522
716
|
<td>align(<b>number</b>)</td>
|
|
523
717
|
<td align="center">Aligns byte position to number.</td>
|
|
524
718
|
<td ><b>Note:</b> Errors in strict mode when change is outside of data size.</td>
|
|
525
719
|
</tr>
|
|
526
720
|
<tr>
|
|
527
|
-
<td>
|
|
721
|
+
<td>Function</td>
|
|
528
722
|
<td>alignRev(<b>number</b>)</td>
|
|
529
723
|
<td align="center">Reverse aligns byte position to number.</td>
|
|
530
724
|
<td ><b>Note:</b> Errors in strict mode when change is outside of data size.</td>
|
|
531
725
|
</tr>
|
|
532
726
|
<tr>
|
|
533
|
-
<td>
|
|
727
|
+
<td>Function</td>
|
|
534
728
|
<td>skip(<b>bytes</b>, bits)</td>
|
|
535
729
|
<td align="center" rowspan="2"><b>Bytes to skip from current byte position</b>, bits to skip (default 0)</td>
|
|
536
730
|
<td rowspan="2">Use negative to go back.<br><b>Note:</b> Remaining bits are dropped when returning to a byte function.</td>
|
|
@@ -540,9 +734,9 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
540
734
|
<td>FSeek(<b>byte</b>, bit)<br>seek(<b>byte</b>, bit)<br>jump(<b>bytes</b>, bits)</td>
|
|
541
735
|
</tr>
|
|
542
736
|
<tr>
|
|
543
|
-
<td>
|
|
737
|
+
<td>Function</td>
|
|
544
738
|
<td>goto(<b>byte</b>, bit)</td>
|
|
545
|
-
<td align="center" rowspan="2"><b>Byte offset from start</b>,
|
|
739
|
+
<td align="center" rowspan="2"><b>Byte offset from start</b>, bits within byte offset</td>
|
|
546
740
|
<td rowspan="2"><b>Note:</b> Remaining bits are drop when returning to byte function.</td>
|
|
547
741
|
</tr>
|
|
548
742
|
<tr>
|
|
@@ -550,7 +744,7 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
550
744
|
<td>pointer(<b>byte</b>, bit)<br>warp(<b>byte</b>, bit)</td>
|
|
551
745
|
</tr>
|
|
552
746
|
<tr>
|
|
553
|
-
<td>
|
|
747
|
+
<td>Function</td>
|
|
554
748
|
<td>rewind()</td>
|
|
555
749
|
<td align="center" rowspan="2">None</td>
|
|
556
750
|
<td rowspan="2">Moves current byte position to start of data.</td>
|
|
@@ -560,7 +754,7 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
560
754
|
<td>gotoStart()</td>
|
|
561
755
|
</tr>
|
|
562
756
|
<tr>
|
|
563
|
-
<td>
|
|
757
|
+
<td>Function</td>
|
|
564
758
|
<td>last()</td>
|
|
565
759
|
<td align="center" rowspan="2">None</td>
|
|
566
760
|
<td rowspan="2">Moves current byte position to end of data.</td>
|
|
@@ -571,13 +765,13 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
571
765
|
</tr>
|
|
572
766
|
<th align="center" colspan="4"><i>Manipulation</i></th>
|
|
573
767
|
<tr>
|
|
574
|
-
<td>
|
|
768
|
+
<td>Function</td>
|
|
575
769
|
<td>delete(startOffset, endOffset, consume)</td>
|
|
576
770
|
<td align="center">Start byte of data (default 0), end byte of data (default current byte position), move byte position to after data read (default false)</td>
|
|
577
771
|
<td >Removes and returns data. <br><b>Note:</b> Errors on strict mode</td>
|
|
578
772
|
</tr>
|
|
579
773
|
<tr>
|
|
580
|
-
<td>
|
|
774
|
+
<td>Function</td>
|
|
581
775
|
<td>clip()</td>
|
|
582
776
|
<td align="center" rowspan="2">None</td>
|
|
583
777
|
<td rowspan="2">Removes data after the current byte position and returns data. <br><b>Note:</b> Errors on strict mode</td>
|
|
@@ -587,7 +781,7 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
587
781
|
<td>trim()</td>
|
|
588
782
|
</tr>
|
|
589
783
|
<tr>
|
|
590
|
-
<td>
|
|
784
|
+
<td>Function</td>
|
|
591
785
|
<td>crop(<b>length</b>, consume)</td>
|
|
592
786
|
<td align="center" rowspan="2"><b>Number of bytes to read and remove from current byte position</b>, move byte position to after data read (default false)</td>
|
|
593
787
|
<td rowspan="2">Removes and returns data from current byte position for length of data</b>.<br><b>Note:</b> Errors on strict mode</td>
|
|
@@ -597,17 +791,17 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
597
791
|
<td>drop(<b>length</b>, consume)</td>
|
|
598
792
|
</tr>
|
|
599
793
|
<tr>
|
|
600
|
-
<td>
|
|
601
|
-
<td>replace(<b>data</b>,
|
|
794
|
+
<td>Function</td>
|
|
795
|
+
<td>replace(<b>data</b>, offset, consume)</td>
|
|
602
796
|
<td align="center" rowspan="2"><b>Data to replace in supplied data</b>, move byte position to after data read (default false), byte position to start replace (default current byte position)</td>
|
|
603
797
|
<td rowspan="2">Replaces data at current byte or supplied offset.<br><b>Note:</b> Errors on strict mode</td>
|
|
604
798
|
</tr>
|
|
605
799
|
<tr>
|
|
606
800
|
<td>Alias</td>
|
|
607
|
-
<td>
|
|
801
|
+
<td>overwrite(<b>data</b>, offset, consume)</td>
|
|
608
802
|
</tr>
|
|
609
803
|
<tr>
|
|
610
|
-
<td>
|
|
804
|
+
<td>Function</td>
|
|
611
805
|
<td>lift(startByte, endByte, consume, fillValue)</td>
|
|
612
806
|
<td align="center" rowspan="2">Start of byte read (default current byte position), end of byte read (default end of data), move current byte position to end of byte read (default false), value to fill bytes (will <b>NOT</b> fill on default)</td>
|
|
613
807
|
<td rowspan="2">Returns data from supplied byte positions. <br><b>Note:</b> Only moves current byte position if consume is true. Only fills data if value is supplied</td>
|
|
@@ -617,7 +811,7 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
617
811
|
<td>fill(startByte, endByte, consume, fillValue)</td>
|
|
618
812
|
</tr>
|
|
619
813
|
<tr>
|
|
620
|
-
<td>
|
|
814
|
+
<td>Function</td>
|
|
621
815
|
<td>extract(<b>length</b>, consume)</td>
|
|
622
816
|
<td align="center" rowspan="2"><b>Number of bytes to read</b>, move byte position to after data read (default false)</td>
|
|
623
817
|
<td rowspan="2">Returns data from current byte position for length of data</b>.</td>
|
|
@@ -627,17 +821,17 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
627
821
|
<td>readbytes(amount, unsigned), slice(<b>length</b>, consume)<br>wrap(<b>length</b>, consume)</td>
|
|
628
822
|
</tr>
|
|
629
823
|
<tr>
|
|
630
|
-
<td>
|
|
631
|
-
<td>insert(<b>data</b>,
|
|
632
|
-
<td align="center" rowspan="2"><b>New data to insert</b>,
|
|
824
|
+
<td>Function</td>
|
|
825
|
+
<td>insert(<b>data</b>, offset, consume)</td>
|
|
826
|
+
<td align="center" rowspan="2"><b>New data to insert</b>, byte position to insert (default current byte position), move byte position to after data read (default true)</td>
|
|
633
827
|
<td rowspan="2">Inserts new data into supplied data. <b>Note:</b> Data type must match supplied data. Errors on strict mode</td>
|
|
634
828
|
</tr>
|
|
635
829
|
<tr>
|
|
636
830
|
<td>Aliases</td>
|
|
637
|
-
<td>place(<b>data</b>, consume, offset)</td>
|
|
831
|
+
<td>place(<b>data</b>, consume, offset), write(<b>data</b>, consume, offset)</td>
|
|
638
832
|
</tr>
|
|
639
833
|
<tr>
|
|
640
|
-
<td>
|
|
834
|
+
<td>Function</td>
|
|
641
835
|
<td>unshift(<b>data</b>, consume)</td>
|
|
642
836
|
<td align="center" rowspan="2"><b>New data to insert</b>, move byte position to after data read (default false)</td>
|
|
643
837
|
<td rowspan="2">Adds new data to start of supplied data<br><b>Note:</b> Data type must match supplied data. Errors on strict mode</td>
|
|
@@ -647,9 +841,9 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
647
841
|
<td>prepend(<b>data</b>, consume)</td>
|
|
648
842
|
</tr>
|
|
649
843
|
<tr>
|
|
650
|
-
<td>
|
|
651
|
-
<td>push(<b>
|
|
652
|
-
<td align="center" rowspan="2"><b>
|
|
844
|
+
<td>Function</td>
|
|
845
|
+
<td>push(<b>data</b>, consume)</td>
|
|
846
|
+
<td align="center" rowspan="2"><b>New data to insert</b>, move byte position to after data read (default false)</td>
|
|
653
847
|
<td rowspan="2">Adds new data to end of supplied data<br><b>Note:</b> Data type must match supplied data. Errors on strict mode</td>
|
|
654
848
|
</tr>
|
|
655
849
|
<tr>
|
|
@@ -658,85 +852,85 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
658
852
|
</tr>
|
|
659
853
|
<th align="center" colspan="4"><i>Math</i></th>
|
|
660
854
|
<tr>
|
|
661
|
-
<td>
|
|
855
|
+
<td>Function</td>
|
|
662
856
|
<td>xor(<b>xorKey</b>, startOffset, endOffset, consume)
|
|
663
857
|
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
664
858
|
<td >XOR data. <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
665
859
|
</tr>
|
|
666
860
|
<tr>
|
|
667
|
-
<td>
|
|
861
|
+
<td>Function</td>
|
|
668
862
|
<td>xorThis(<b>xorKey</b>, length, consume)
|
|
669
863
|
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, length of bytes starting at current byte (repeats when longer, default 1 byte for byte value, string length or end of data for string, array length or end of data for array or Buffer), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
670
864
|
<td>XOR data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
671
865
|
</tr>
|
|
672
866
|
<tr>
|
|
673
|
-
<td>
|
|
867
|
+
<td>Function</td>
|
|
674
868
|
<td>or(<b>orKey</b>, startOffset, endOffset, consume)
|
|
675
869
|
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
676
870
|
<td >OR data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
677
871
|
</tr>
|
|
678
872
|
<tr>
|
|
679
|
-
<td>
|
|
873
|
+
<td>Function</td>
|
|
680
874
|
<td>orThis(<b>orKey</b>, length, consume)
|
|
681
875
|
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, length of bytes starting at current byte (repeats when longer, default 1 byte for byte value, string length or end of data for string, array length or end of data for array or Buffer), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
682
876
|
<td>OR data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
683
877
|
</tr>
|
|
684
878
|
<tr>
|
|
685
|
-
<td>
|
|
879
|
+
<td>Function</td>
|
|
686
880
|
<td>and(<b>andKey</b>, startOffset, endOffset, consume)
|
|
687
881
|
<td align="center"><b>Byte value, string, number array or Buffer</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
688
882
|
<td >AND data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
689
883
|
</tr>
|
|
690
884
|
<tr>
|
|
691
|
-
<td>
|
|
885
|
+
<td>Function</td>
|
|
692
886
|
<td>andThis(<b>andKey</b>, length, consume)
|
|
693
887
|
<td align="center"><b>Byte value, string, number array or Buffer</b>, length of bytes starting at current byte (repeats when longer, default 1 byte for byte value, string length or end of data for string, array length or end of data for array or Buffer), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
694
888
|
<td>AND data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
695
889
|
</tr>
|
|
696
890
|
<tr>
|
|
697
|
-
<td>
|
|
891
|
+
<td>Function</td>
|
|
698
892
|
<td>add(<b>addKey</b>, startOffset, endOffset, consume)
|
|
699
893
|
<td align="center"><b>Byte value, string, number array or Buffer</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
700
894
|
<td >Add value to data (per byte). <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
701
895
|
</tr>
|
|
702
896
|
<tr>
|
|
703
|
-
<td>
|
|
897
|
+
<td>Function</td>
|
|
704
898
|
<td>addThis(<b>addKey</b>, length, consume)
|
|
705
899
|
<td align="center"><b>Byte value, string, number array or Buffer</b>, length of bytes starting at current byte (repeats when longer, default 1 byte for byte value, string length or end of data for string, array length or end of data for array or Buffer), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
706
900
|
<td>Add value to data (per byte)</td>
|
|
707
901
|
</tr>
|
|
708
902
|
<tr>
|
|
709
|
-
<td>
|
|
903
|
+
<td>Function</td>
|
|
710
904
|
<td>not(startOffset, endOffset, consume)
|
|
711
905
|
<td align="center">Byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
712
906
|
<td >NOT data (per byte)</td>
|
|
713
907
|
</tr>
|
|
714
908
|
<tr>
|
|
715
|
-
<td>
|
|
909
|
+
<td>Function</td>
|
|
716
910
|
<td>notThis(length, consume)
|
|
717
911
|
<td align="center">Length of bytes starting at current byte position (default 1), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
718
912
|
<td>NOT data (per byte)</td>
|
|
719
913
|
</tr>
|
|
720
914
|
<tr>
|
|
721
|
-
<td>
|
|
915
|
+
<td>Function</td>
|
|
722
916
|
<td>lShift(<b>shiftKey</b>, startOffset, endOffset, consume)
|
|
723
917
|
<td align="center"><b>Byte value, string, number array or Buffer</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
724
918
|
<td >Left shift data (per byte). <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
725
919
|
</tr>
|
|
726
920
|
<tr>
|
|
727
|
-
<td>
|
|
921
|
+
<td>Function</td>
|
|
728
922
|
<td>lShiftThis(<b>shiftKey</b>, length, consume)
|
|
729
923
|
<td align="center"><b>Byte value, string, number array or Buffer</b>, length of bytes starting at current byte (repeats when longer, default 1 byte for byte value, string length or end of data for string, array length or end of data for array or Buffer), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
730
924
|
<td>Left shift data (per byte)</td>
|
|
731
925
|
</tr>
|
|
732
926
|
<tr>
|
|
733
|
-
<td>
|
|
927
|
+
<td>Function</td>
|
|
734
928
|
<td>rShift(<b>shiftKey</b>, startOffset, endOffset, consume)
|
|
735
929
|
<td align="center"><b>Byte value, string, number array or Buffer</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
736
930
|
<td >Right shift data (per byte). <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
737
931
|
</tr>
|
|
738
932
|
<tr>
|
|
739
|
-
<td>
|
|
933
|
+
<td>Function</td>
|
|
740
934
|
<td>rShiftThis(<b>shiftKey</b>, length, consume)
|
|
741
935
|
<td align="center"><b>Byte value, string, number array or Buffer</b>, length of bytes starting at current byte (repeats when longer, default 1 byte for byte value, string length or end of data for string, array length or end of data for array or Buffer), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
742
936
|
<td>Right shift data (per byte)</td>
|
|
@@ -744,80 +938,47 @@ Common functions for setup, movement, manipulation and math shared by both.
|
|
|
744
938
|
</tbody>
|
|
745
939
|
</table>
|
|
746
940
|
|
|
747
|
-
##
|
|
941
|
+
## Async
|
|
748
942
|
|
|
749
|
-
With
|
|
943
|
+
With 4.0 you can now use ``BiReaderAsync`` and ``BiWriterAsync`` for async operations. Pass a normal Buffer, Uint8Array or a string path (only in Node.js). When passed a Buffer or Uint8Array, it's uses the same logic as the sync class. When working with reading or creating a file, the class async loads the files in chunks for quick editing (window size is editing). This class is designed for larger files where you don't want to load the whole file buffer into memory all at once or need an async class.
|
|
750
944
|
|
|
751
|
-
**
|
|
945
|
+
**Naming:** Same function naming applies to async as [Common Functions](#common-functions) section but these classes use all async functions, **so `get` and `set` methods are now also async functions.**
|
|
752
946
|
|
|
753
947
|
<table>
|
|
754
948
|
<thead>
|
|
755
949
|
<tr>
|
|
756
|
-
<th align="center" colspan="2">
|
|
950
|
+
<th align="center" colspan="2">Methods</th>
|
|
757
951
|
<th align="center">Params (bold requires)</th>
|
|
758
952
|
<th align="left">Desc</th>
|
|
759
953
|
</tr>
|
|
760
954
|
</thead>
|
|
761
955
|
<tbody>
|
|
762
956
|
<tr>
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
<
|
|
766
|
-
<td>Name</td>
|
|
767
|
-
<td>new BiReaderStream(<b>filePath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize})</td>
|
|
768
|
-
<td align="center" rowspan="2"><b>Path to file</b>, byte offset (default 0), bit offset (default 0), endian big or little (default little), strict mode true to restrict extending file size (default true for reader, false for writer), extended file size amount.
|
|
957
|
+
<td>Class</td>
|
|
958
|
+
<td>new BiReaderAsync(<b>dataOrFilePath</b>, {byteOffset, bitOffset, endianess, strict, growthIncrement, readOnly, windowSize})</td>
|
|
959
|
+
<td rowspan="2"><b>dataOrPath:</b> string path or Buffer or Uint8Array</b><br><b>byteOffset:</b> byte offset (default <code>0</code>)<br><b>bitOffset:</b> bit offset (overides <code>byteOffset</code>) (default <code>0</code>)<br><b>endianess:</b> endian big or little (default <code>little</code>)<br><b>strict:</b> strict mode restrict extending initially supplied data (default <code>true</code> for reader, <code>false</code> for writer)<br><b>growthIncrement:</b> default extended Buffer size (default <code>1 MiB</code>)<br><b>enforceBigInt:</b> always return <code>bigint</code> values on 64 bit reads (default <code>false</code>)<br><b>readOnly:</b> read only Buffer or file (default <code>true</code> in writer)<br><b>windowSize:</b> The chunk size when reading files. Set to <code>0</code> if you want the whole file read in one async cycle (default <code>4 KiB</code>)
|
|
769
960
|
</td>
|
|
770
|
-
<td rowspan="2">Start with new Constructor.<br><br><b>Note:</b> The file must be opened with <
|
|
771
|
-
</tr>
|
|
772
|
-
<tr>
|
|
773
|
-
<td>Name</td>
|
|
774
|
-
<td>new BiWriterStream(<b>filePath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize})</td>
|
|
775
|
-
</tr>
|
|
776
|
-
<th align="center" colspan="4"><i>File Control</i></th>
|
|
777
|
-
<tr>
|
|
778
|
-
<td>Name</td>
|
|
779
|
-
<td>open()
|
|
780
|
-
<td align="center"><b>none</td>
|
|
781
|
-
<td>Opens file for reading / writing.</td>
|
|
782
|
-
</tr>
|
|
783
|
-
<tr>
|
|
784
|
-
<td>Name</td>
|
|
785
|
-
<td>close()
|
|
786
|
-
<td align="center"><b>none</td>
|
|
787
|
-
<td>Closes file after reading / writing.</td>
|
|
961
|
+
<td rowspan="2">Start with new Constructor.<br><br><b>Note:</b> The file must be opened with await <code>.open()</code> and closed with await <code>.close()</code>. The <b>.data</b> can't be used in file mode, so use await <code>.get()</code> or <code>.return()</code></td>
|
|
788
962
|
</tr>
|
|
789
963
|
<tr>
|
|
790
|
-
<td>
|
|
791
|
-
<td>
|
|
792
|
-
<td align="center"><b>True if you want to switch to writing in BiReaderStream.</td>
|
|
793
|
-
<td>Note: This changes reader to write mode. Allows file to be expanded in size as well.</td>
|
|
794
|
-
</tr>
|
|
795
|
-
<tr>
|
|
796
|
-
<td>Name</td>
|
|
797
|
-
<td>renameFile(<b>newFilePath</b>)
|
|
798
|
-
<td align="center"><b>Full path to file to rename.</td>
|
|
799
|
-
<td>Renames the file on the file system, keeps read / write position.<br/><br/><b>Note: This is permanent.</b></td>
|
|
964
|
+
<td>Class</td>
|
|
965
|
+
<td>new BiWriterAsync(<b>dataOrFilePath</b>, {byteOffset, bitOffset, endianess, strict, growthIncrement, readOnly, windowSize})</td>
|
|
800
966
|
</tr>
|
|
967
|
+
<th align="center" colspan="4"><i>Quick Create</i></th>
|
|
801
968
|
<tr>
|
|
802
|
-
<td>
|
|
803
|
-
<td>
|
|
804
|
-
<td
|
|
805
|
-
<td>
|
|
969
|
+
<td>Function</td>
|
|
970
|
+
<td>create(<b>dataOrFilePath</b>, {byteOffset, bitOffset, endianess, strict, growthIncrement, readOnly, windowSize})
|
|
971
|
+
<td>Same as above</tb>
|
|
972
|
+
<td>Static async function that creates and opens the class all at once.</td>
|
|
806
973
|
</tr>
|
|
807
974
|
</tbody>
|
|
808
975
|
</table>
|
|
809
976
|
|
|
810
|
-
### Streaming Caveats
|
|
811
|
-
|
|
812
|
-
* Naming: Same function naming applies to streamers as [Common Functions](#common-functions) section but the file is saved after every operation. **BiReaderStream / BiReader** and **BiWriterStream / BiWriter** are interchangeable when it comes to all functions and class objects names for easy use with type script.
|
|
813
|
-
* Writing: Unlike the other BiReader, **all write functions will throw an error unless you switch to ``.writeMode(true)``** The file is read only until you do. Any write functions inside the reader will error beforehand.
|
|
814
|
-
* Large removal: When using any function that removes data from the file and would return a Buffer, **if the size of the returned Buffer is outside of the Node max size for a Buffer, a new file will be made with the location and size concat to the name with a .removed file extention instead.**
|
|
815
|
-
|
|
816
977
|
## Bit field
|
|
817
978
|
|
|
818
|
-
Parse value as a bit field. There are 32 functions from bit1 to bit32 and can be signed or unsigned (with a
|
|
979
|
+
Parse value as a bit field. There are 32 functions from bit1 to bit32 and can be signed or unsigned (with a `u` at the start) and in little or big endian order (`be` or `le` at the end).
|
|
819
980
|
|
|
820
|
-
**Note:** Remaining bits are dropped when returning to a byte read. Example, after using
|
|
981
|
+
**Note:** Remaining bits are dropped when returning to a byte read. Example, after using `bit4` then `ubyte`, the read locations drops the remaining 4 bits after `bit4` when reading `ubyte`. Any bit reading under 8 will always be unsigned.
|
|
821
982
|
|
|
822
983
|
<table>
|
|
823
984
|
<thead>
|
|
@@ -840,19 +1001,19 @@ Parse value as a bit field. There are 32 functions from bit1 to bit32 and can be
|
|
|
840
1001
|
<tr>
|
|
841
1002
|
<td align="center"><b>Presets (reader)</b></td>
|
|
842
1003
|
<td>[u]bit{1-32}{le|be}</td>
|
|
843
|
-
<td>*Note:
|
|
1004
|
+
<td>*Note: In BiReader these are get, not functions.</td>
|
|
844
1005
|
</tr>
|
|
845
1006
|
<tr>
|
|
846
1007
|
<td align="center"><b>Presets (writer)</b></td>
|
|
847
1008
|
<td>[u]bit{1-32}{le|be} = <b>value</b></td>
|
|
848
|
-
<td>*Note:
|
|
1009
|
+
<td>*Note: In BiWriter these are set, not functions.</td>
|
|
849
1010
|
</tr>
|
|
850
1011
|
</tbody>
|
|
851
1012
|
</table>
|
|
852
1013
|
|
|
853
1014
|
## Byte
|
|
854
1015
|
|
|
855
|
-
Parse value as a byte (aka int8). Can be signed or unsigned (with a
|
|
1016
|
+
Parse value as a byte (aka int8). Can be signed or unsigned (with a `u` at the start).
|
|
856
1017
|
|
|
857
1018
|
<table>
|
|
858
1019
|
<thead>
|
|
@@ -887,7 +1048,7 @@ Parse value as a byte (aka int8). Can be signed or unsigned (with a ``u`` at the
|
|
|
887
1048
|
|
|
888
1049
|
## Short
|
|
889
1050
|
|
|
890
|
-
Parse value as a int16 (aka short or word). Can be signed or unsigned (with a
|
|
1051
|
+
Parse value as a int16 (aka short or word). Can be signed or unsigned (with a `u` at the start) and in little or big endian order (`be` or `le` at the end).
|
|
891
1052
|
|
|
892
1053
|
<table>
|
|
893
1054
|
<thead>
|
|
@@ -922,7 +1083,7 @@ Parse value as a int16 (aka short or word). Can be signed or unsigned (with a ``
|
|
|
922
1083
|
|
|
923
1084
|
## Half Float
|
|
924
1085
|
|
|
925
|
-
Parse value as a half float (aka half). Can be in little or big endian order (
|
|
1086
|
+
Parse value as a half float (aka half). Can be in little or big endian order (`be` or `le` at the end).
|
|
926
1087
|
|
|
927
1088
|
<table>
|
|
928
1089
|
<thead>
|
|
@@ -957,7 +1118,7 @@ Parse value as a half float (aka half). Can be in little or big endian order (``
|
|
|
957
1118
|
|
|
958
1119
|
## Integer
|
|
959
1120
|
|
|
960
|
-
Parse value as a int32 (aka int, long or double). Can be signed or unsigned (with a
|
|
1121
|
+
Parse value as a int32 (aka int, long or double). Can be signed or unsigned (with a `u` at the start) and in little or big endian order (`be` or `le` at the end).
|
|
961
1122
|
|
|
962
1123
|
<table>
|
|
963
1124
|
<thead>
|
|
@@ -992,7 +1153,7 @@ Parse value as a int32 (aka int, long or double). Can be signed or unsigned (wi
|
|
|
992
1153
|
|
|
993
1154
|
## Float
|
|
994
1155
|
|
|
995
|
-
Parse value as a float. Can be in little or big endian order (
|
|
1156
|
+
Parse value as a float. Can be in little or big endian order (`be` or `le` at the end).
|
|
996
1157
|
|
|
997
1158
|
<table>
|
|
998
1159
|
<thead>
|
|
@@ -1027,7 +1188,7 @@ Parse value as a float. Can be in little or big endian order (``be`` or ``le`` a
|
|
|
1027
1188
|
|
|
1028
1189
|
## Quadword
|
|
1029
1190
|
|
|
1030
|
-
Parse value as a int64 (aka quad or bigint). Can be signed or unsigned (with a
|
|
1191
|
+
Parse value as a int64 (aka quad or bigint). Can be signed or unsigned (with a `u` at the start) and in little or big endian order (`be` or `le` at the end).
|
|
1031
1192
|
|
|
1032
1193
|
<table>
|
|
1033
1194
|
<thead>
|
|
@@ -1062,7 +1223,7 @@ Parse value as a int64 (aka quad or bigint). Can be signed or unsigned (with a `
|
|
|
1062
1223
|
|
|
1063
1224
|
## Double Float
|
|
1064
1225
|
|
|
1065
|
-
Parse value as a double float (aka dfloat). Can be in little or big endian order (
|
|
1226
|
+
Parse value as a double float (aka dfloat). Can be in little or big endian order (`be` or `le` at the end).
|
|
1066
1227
|
|
|
1067
1228
|
<table>
|
|
1068
1229
|
<thead>
|
|
@@ -1097,11 +1258,10 @@ Parse value as a double float (aka dfloat). Can be in little or big endian order
|
|
|
1097
1258
|
|
|
1098
1259
|
## Strings
|
|
1099
1260
|
|
|
1100
|
-
Parse a string in any format. Be sure to use options object for formatting unless using a preset. Strings with larger than 1 byte character reads can use
|
|
1261
|
+
Parse a string in any format. Either null terminated strings (utf) or fixed length (pascal). Be sure to use options object for formatting unless using a preset. Default string settings can be stored in `strSettings`. Strings with larger than 1 byte character reads can use `be` or `le` at the end for little or big endian.
|
|
1101
1262
|
|
|
1102
1263
|
Presents include C or Unicode, Ansi and multiple pascals.
|
|
1103
1264
|
|
|
1104
|
-
|
|
1105
1265
|
<table>
|
|
1106
1266
|
<thead>
|
|
1107
1267
|
<tr>
|
|
@@ -1124,7 +1284,7 @@ Presents include C or Unicode, Ansi and multiple pascals.
|
|
|
1124
1284
|
endian<br>
|
|
1125
1285
|
})
|
|
1126
1286
|
</td>
|
|
1127
|
-
<td><
|
|
1287
|
+
<td><b>length:</b> Length in uints (NOT bytes) for non-terminate UTF strings. If not supplied, reads until <code>0x00</code> or supplied terminate value (for fixed length UTF strings only)<br><b>stringType:</b> String type. Defaults to utf-8 (<code>utf-8</code>, <code>utf-16</code>, <code>utf-32</code>, <code>pascal</code>, <code>wide-pascal</code>, <code>double-wide-pascal</code> accepted)<br><b>terminateValue:</b> Terminate value. Default is <code>0x00</code> (for non-fixed length utf strings)<br><b>lengthReadSize:</b> Size of the first value that defines the length of the string. Defaults to <code>1</code> as uint8, respects supplied endian (for Pascal strings only, accepts <code>1</code>, <code>2</code> or <code>4</code> bytes)<br><b>stripNull:</b> Removes 0x00 characters on read (default <code>true</code>)<br><b>encoding:</b> Defaults to <code>utf-8</code> (accepts all TextDecoder options)<br><b>endian:</b> for <code>utf-16</code>, <code>utf-32</code>, <code>wide-pascal</code> and <code>double-wide-pascal</code> character order</td>
|
|
1128
1288
|
</tr>
|
|
1129
1289
|
<tr>
|
|
1130
1290
|
<td>writeString(<b>string</b>, {<br>
|
|
@@ -1135,33 +1295,91 @@ Presents include C or Unicode, Ansi and multiple pascals.
|
|
|
1135
1295
|
encoding,<br>
|
|
1136
1296
|
endian<br>
|
|
1137
1297
|
})</td>
|
|
1138
|
-
<td
|
|
1298
|
+
<td>
|
|
1299
|
+
<b>string:</b> String to write<br>
|
|
1300
|
+
length:</b> Length in uints (NOT bytes) for non-terminate UTF strings. If not supplied, reads until <code>0x00</code> or supplied terminate value (for fixed length UTF strings only, in units NOT bytes)<br>
|
|
1301
|
+
<b>stringType:</b> String type. Defaults to utf-8 (<code>utf-8</code>, <code>utf-16</code>, <code>utf-32</code>, <code>pascal</code>, <code>wide-pascal</code>, <code>double-wide-pascal</code> accepted)<br>
|
|
1302
|
+
<b>terminateValue:</b> Terminate value. Default is <code>0x00</code> (for non-fixed length utf strings)<br>
|
|
1303
|
+
<b>lengthReadSize:</b> Size of the first value that defines the length of the string. Defaults to <code>1</code> as uint8, respects supplied endian (for Pascal strings only, accepts <code>1</code>, <code>2</code> or <code>4</code> bytes)<br>
|
|
1304
|
+
<b>encoding:</b> Defaults to <code>utf-8</code> (accepts all TextDecoder options)<br>
|
|
1305
|
+
<b>endian:</b> for <code>utf-16</code>, <code>utf-32</code>, <code>wide-pascal</code> and <code>double-wide-pascal</code> character order</td>
|
|
1306
|
+
</tr>
|
|
1307
|
+
<tr>
|
|
1308
|
+
<td><b>Default settings</b></td>
|
|
1309
|
+
<td>strSettings = {length?, stringType?, terminateValue?, lengthReadSize?, lengthWriteSize?, stripNull?, encoding?, endian?}</td>
|
|
1310
|
+
<td>
|
|
1311
|
+
<b>length:</b> Length of string for fixed length, non-terminate value utf strings (in units NOT bytes)<br/>
|
|
1312
|
+
<b>stringType:</b> <code>utf-8</code>, <code>utf-16</code>, <code>utf-32</code>,<code>pascal</code>, <code>wide-pascal</code> or <code>double-wide-pascal</code>. Default <code>utf-8</code>.<br/>
|
|
1313
|
+
<b>terminateValue:</b> Number only with <code>stringType</code> of utf types.<br/>
|
|
1314
|
+
<b>lengthReadSize</b> For pascal strings. 1, 2 or 4 byte length read size. Default <code>1</code><br/>
|
|
1315
|
+
<b>lengthWriteSize:</b> For pascal strings. 1, 2 or 4 byte length write size. Default <code>1</code>.<br/>
|
|
1316
|
+
<b>stripNull:</b> Removes code>0x00</code> characters. default <code>true</code><br/>
|
|
1317
|
+
<b>encoding:</b> TextEncoder accepted types. Default <code>utf-8</code>.<br/>
|
|
1318
|
+
<b>endian:</b> <code>big</code> or <code>little</code><br/>
|
|
1319
|
+
</td>
|
|
1139
1320
|
</tr>
|
|
1140
1321
|
<tr>
|
|
1141
|
-
<td
|
|
1322
|
+
<td><b>get / set</b></td>
|
|
1323
|
+
<td>str()</td>
|
|
1324
|
+
<td>
|
|
1325
|
+
Quickly read or write a string with the set <code>strSettings</code> options.
|
|
1326
|
+
</td>
|
|
1327
|
+
</tr>
|
|
1328
|
+
<tr>
|
|
1329
|
+
<td align="center"><b>Functions (reader)</b></td>
|
|
1330
|
+
<td>
|
|
1331
|
+
{c|utf8}string(length, terminateValue, stripNull)<br>
|
|
1332
|
+
ansistring(length, terminateValue, stripNull)<br>
|
|
1333
|
+
pstring(lengthReadSize, stripNull, endian)<br>
|
|
1334
|
+
pstring{1|2|4}{be|le}(stripNull, endian)
|
|
1335
|
+
</td>
|
|
1336
|
+
<td>Get a single byte string as a fixed length (pascal) or null terminated (utf) string</td>
|
|
1337
|
+
</tr>
|
|
1338
|
+
<tr>
|
|
1339
|
+
<td align="center"><b>Functions (reader)</b></td>
|
|
1340
|
+
<td>
|
|
1341
|
+
{utf16|uni}string(length, terminateValue, stripNull, endian)<br>
|
|
1342
|
+
wpstring{be|le}(lengthReadSize, stripNull, endian)<br>
|
|
1343
|
+
wpstring{1|2|4}{be|le}(stripNull, endian)
|
|
1344
|
+
</td>
|
|
1345
|
+
<td>Get a wide (2 byte) string as a fixed length (pascal) or null terminated (utf) string</td>
|
|
1346
|
+
</tr>
|
|
1347
|
+
<tr>
|
|
1348
|
+
<td align="center"><b>Functions (reader)</b></td>
|
|
1349
|
+
<td>
|
|
1350
|
+
utf32string{be|le}(length, terminateValue, stripNull, endian)<br>
|
|
1351
|
+
dwpstring{be|le}(lengthReadSize, stripNull, endian)<br>
|
|
1352
|
+
dwpstring{1|2|4}{be|le}(stripNull, endian)
|
|
1353
|
+
</td>
|
|
1354
|
+
<td>Get a double wide (4 byte) string as a fixed length (pascal) or null terminated (utf) string</td></td>
|
|
1355
|
+
</tr>
|
|
1356
|
+
<tr>
|
|
1357
|
+
<td align="center"><b>Functions (writer)</b></td>
|
|
1358
|
+
<td>
|
|
1359
|
+
{c|utf8}string(<b>string</b>, length, terminateValue)<br>
|
|
1360
|
+
ansistring(<b>string</b>, length, terminateValue)<br>
|
|
1361
|
+
pstring(<b>string</b>, lengthWriteSize, endian)<br>
|
|
1362
|
+
pstring{1|2|4}{be|le}(<b>string</b>, endian)
|
|
1363
|
+
</td>
|
|
1364
|
+
<td>Write a single byte string as a fixed length (pascal) or null terminated (utf) string</td>
|
|
1365
|
+
</tr>
|
|
1366
|
+
<tr>
|
|
1367
|
+
<td align="center"><b>Functions (writer)</b></td>
|
|
1142
1368
|
<td>
|
|
1143
|
-
{
|
|
1144
|
-
|
|
1145
|
-
{
|
|
1146
|
-
pstring(lengthReadSize, stripNull, *endian)<br><br>
|
|
1147
|
-
pstring{1|2|4}{be|le}(stripNull, *endian)<br><br>
|
|
1148
|
-
wpstring{be|le}(lengthReadSize, stripNull, *endian)<br><br>
|
|
1149
|
-
wpstring{1|2|4}{be|le}(stripNull, *endian)
|
|
1369
|
+
{utf16|uni}string{be|le}(<b>string</b>,length, terminateValue, endian)<br>
|
|
1370
|
+
wpstring{be|le}(<b>string</b>, lengthWriteSize, endian)<br>
|
|
1371
|
+
wpstring{1|2|4}{be|le}(<b>string</b>, endian)
|
|
1150
1372
|
</td>
|
|
1151
|
-
<td>
|
|
1373
|
+
<td>Write a wide (2 byte) string as a fixed length (pascal) or null terminated (utf) string</td>
|
|
1152
1374
|
</tr>
|
|
1153
1375
|
<tr>
|
|
1154
|
-
|
|
1376
|
+
<td align="center"><b>Functions (writer)</b></td>
|
|
1155
1377
|
<td>
|
|
1156
|
-
{
|
|
1157
|
-
|
|
1158
|
-
{
|
|
1159
|
-
pstring(<b>string</b>, lengthWriteSize, *endian)<br><br>
|
|
1160
|
-
pstring{1|2|4}{be|le}(<b>string</b>, *endian)<br><br>
|
|
1161
|
-
wpstring{be|le}(<b>string</b>, lengthWriteSize, *endian)<br><br>
|
|
1162
|
-
wpstring{1|2|4}{be|le}(<b>string</b>, *endian)
|
|
1378
|
+
utf32string{be|le}(<b>string</b>,length, terminateValue, endian)<br>
|
|
1379
|
+
dwpstring{be|le}(<b>string</b>, lengthWriteSize, endian)<br>
|
|
1380
|
+
dwpstring{1|2|4}{be|le}(<b>string</b>, endian)
|
|
1163
1381
|
</td>
|
|
1164
|
-
<td>
|
|
1382
|
+
<td>Write a double wide (4 byte) string as a fixed length (pascal) or null terminated (utf) string</td></td>
|
|
1165
1383
|
</tr>
|
|
1166
1384
|
</tbody>
|
|
1167
1385
|
</table>
|