bireader 3.1.14 → 4.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # BiReader / BiWriter
2
2
 
3
- A feature rich binary reader ***and writer*** that keeps track of your position to quickly create file structures. Includes shared naming conventions, programmable inputs and advanced math for easy data conversions on low level parsing. Accepts `Uint8Array`, `Buffer` or a ``filePath`` with [Streams](#bistreams).
3
+ A feature rich binary reader ***and writer*** that keeps track of your position to quickly create file structures. Includes shared naming conventions, programmable inputs and advanced math for easy data conversions on low level parsing. Accepts `Uint8Array`, `Buffer` or a `filePath`.
4
4
 
5
5
  Supported data types:
6
6
 
@@ -12,24 +12,30 @@ Supported data types:
12
12
  - [Floats](#float) (float{le|be}) 32 bit decimal value in big or little endian
13
13
  - [Quadwords](#quadword) ([u]int64, quad, bigint{le|be}) 64 bit signed or unsigned in big or little endian
14
14
  - [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 ```TextEncoder``` types
15
+ - [Strings](#strings) (string) Fixed and non-fixed length, UTF, pascal, wide pascal. Includes all `TextEncoder` types
16
16
 
17
17
  ## What's New?
18
18
 
19
+ ### v4
20
+ * Uses `DataView` read and write functions when possible for more efficient code (previous code is now fallback).
21
+ * Merged `BiReaderStream` and `BiWriterStream` to `BiReader` and `BiWriter` for file reading (Node only).
22
+ * Marked `BiReaderStream` and `BiWriterStream` as deprecated. Use `BiReaderLegacy` or `BiWriterLegacy`. See [BiLegacy](#bilegacy) section.
23
+ * Added `BiReaderAsync` and `BiWriterAsync`. See [Async](#async) section.
24
+
19
25
  ### v3
20
- * Added ``enforceBigInt`` option for always returning a ``BigInt`` type on 64 bit reads, otherwise will return a ``number`` if integer safe.
26
+ * Added `enforceBigInt` option for always returning a `BigInt` type on 64 bit reads, otherwise will return a `number` if integer safe.
21
27
  * Added Browser, Node CommonJS and Node ESM modules.
22
- * Added new ``BiReaderStream`` and ``BiWriterStream`` (Node only) that works without loading the whole file into memory. See [documention](#bistreams) for how to use.
23
- * Added ``.deleteFile()`` and ``.renameFile(filePath)``.
24
- * Added setter ``.strSettings`` for use with ``.str`` for easier coding.
25
- * Added better options for extending array buffer when writing data with ``extendBufferSize``.
28
+ * Added new `BiReaderStream` and `BiWriterStream` (Node only).
29
+ * Added `.deleteFile()` and `.renameFile(filePath)`.
30
+ * Added setter `.strSettings` for use with `.str` for easier coding.
31
+ * Added better options for extending array buffer when writing data with `extendBufferSize`.
26
32
  * Consolidated all options argument into single object when creating class.
27
- * Removed deprecated ``bireader`` and ``biwriter`` classes.
28
- * Fixed standalone ``hexdump`` function.
33
+ * Removed deprecated `bireader` and `biwriter` classes.
34
+ * Fixed standalone `hexdump` function.
29
35
 
30
36
  ### v2
31
- * Created new ``BiReader`` and ``BiWriter`` classes with *get* and *set* functions for easier coding.
32
- * Marked ``bireader`` and ``biwriter`` as deprecated. Set to be removed next update.
37
+ * Created new `BiReader` and `BiWriter` classes with *get* and *set* functions for easier coding.
38
+ * Marked `bireader` and `biwriter` as deprecated. Set to be removed next update.
33
39
 
34
40
  ### v1
35
41
  * Included math functions and value searches.
@@ -37,12 +43,15 @@ Supported data types:
37
43
 
38
44
  ## Installation
39
45
 
40
- ```npm install bireader```
46
+ ``npm install bireader``
41
47
 
42
48
  Provides both CommonJS and ES modules for Node and Browser.
43
49
 
44
50
  ### Example
45
51
 
52
+ <details>
53
+ <summary>Click to expand</summary>
54
+
46
55
  Import the reader or writer. Create a new parser with the data and start parsing.
47
56
 
48
57
  Includes presents for quick parsing or programmable functions (examples below).
@@ -71,12 +80,12 @@ function parse_webp(data){
71
80
  // 000b0 77 44 40 94 6d 25 6c 74 91 a8 88 86 58 9b da 6e wD@.m%lt....X..n
72
81
 
73
82
  const header = {};
74
- header.magic = br.str; // RIFF
75
- header.size = br.uint32le; // 15000
76
- header.fileSize = header.size + 8; // 15008
77
- header.payload = br.str; // WEBP
78
- header.format = br.str; // VP8X
79
- header.formatChunkSize = br.uint32le; // 10
83
+ header.magic = br.str; // RIFF
84
+ header.size = br.uint32le; // 15000
85
+ header.fileSize = header.size + 8; // 15008
86
+ header.payload = br.str; // WEBP
87
+ header.format = br.str; // VP8X
88
+ header.formatChunkSize = br.uint32le; // 10
80
89
  switch (header.format){
81
90
  case "VP8 ":
82
91
  header.formatType = "Lossy";
@@ -293,6 +302,7 @@ function write_webp(data){
293
302
  return bw.return();
294
303
  }
295
304
  ```
305
+ </details>
296
306
 
297
307
  ## Common Functions
298
308
 
@@ -301,7 +311,7 @@ Common functions for setup, movement, manipulation and math shared by both.
301
311
  <table>
302
312
  <thead>
303
313
  <tr>
304
- <th align="center" colspan="2">Function</th>
314
+ <th align="center" colspan="2">Methods</th>
305
315
  <th align="center">Params (bold requires)</th>
306
316
  <th align="left">Desc</th>
307
317
  </tr>
@@ -311,20 +321,20 @@ Common functions for setup, movement, manipulation and math shared by both.
311
321
  <th align="center" colspan="4"><i>Setup</i></th>
312
322
  <tr>
313
323
  <tr>
314
- <td>Name</td>
315
- <td>new BiReader(<b>data</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize, enforceBigInt})</td>
316
- <td align="center" rowspan="2"><b>Buffer or Uint8Array</b>, byte offset (default 0), bit offset (default 0), endian big or little (default little), strict mode true to restrict extending initially supplied data (default true for reader, false for writer), extended Buffer size amount, always return BigInt values on 64 bit reads.
324
+ <td>Class</td>
325
+ <td>new BiReader(<b>dataOrPath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize, enforceBigInt, writeable})</td>
326
+ <td align="center" rowspan="2"><b>string path or Buffer or Uint8Array</b>, byte offset (default 0), bit offset (default 0), endian big or little (default little), strict mode true to restrict extending initially supplied data (default true for reader, false for writer), extended Buffer size amount, always return BigInt values on 64 bit reads, writeable file (default true in BiWriter)
317
327
  </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>Writing data note:</b> while BiWriter can be created with a 0 length Uint8Array or Buffer, each new value write will create a new array and concat the two. For large data writes this will lead 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. <br><br> You can set the <b>extendBufferSize</b> value to always extend by a fixed amount when reaching the end. This will also change the logic for <b>.return</b> and <b>.get</b> to trim the remining data from the current position for you. Use <b>.data</b> instead if you want to get the whole padded buffer array.</td>
328
+ <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. write() automatically commits the supplied data.<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, each new value write will create a new array and concat the two. For large data writes this will lead 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. <br><br> You can set the <b>extendBufferSize</b> value to always extend by a fixed amount when reaching the end. This will also change the logic for <b>.return</b> and <b>.get</b> to trim the remining data from the current position for you. Use <b>.data</b> instead if you want to get the whole padded buffer array.</td>
319
329
  </tr>
320
330
  <tr>
321
- <td>Name</td>
322
- <td>new BiWriter(data, {byteOffset, bitOffset, endianess, strict, extendBufferSize, enforceBigInt})</td>
331
+ <td>Class</td>
332
+ <td>new BiWriter(<b>dataOrPath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize, enforceBigInt, writeable})</td>
323
333
  </tr>
324
334
  <tr>
325
- <td>Name</td>
335
+ <td>Function</td>
326
336
  <td>endianness(<b>"big" | "little"</b>)</td>
327
- <td align="center" rowspan="2"><b>big</b> or <b>little</b> (default little)</td>
337
+ <td align="center" rowspan="2"><code>big</code> or <code>little</code> (default <code>little</code>)</td>
328
338
  <td rowspan="2">Set or change Endian. Can be changed at any time.</td>
329
339
  </tr>
330
340
  <tr>
@@ -332,7 +342,7 @@ Common functions for setup, movement, manipulation and math shared by both.
332
342
  <td>bigEndian(), big(), be()<br>littleEndian(), little(), le()</td>
333
343
  </tr>
334
344
  <tr>
335
- <td>Name</td>
345
+ <td>get</td>
336
346
  <td>length</td>
337
347
  <td align="center" rowspan="2">None</td>
338
348
  <td rowspan="2">Gets the current buffer size in bytes.</td>
@@ -342,7 +352,7 @@ Common functions for setup, movement, manipulation and math shared by both.
342
352
  <td>len, size, FileSize</td>
343
353
  </tr>
344
354
  <tr>
345
- <td>Name</td>
355
+ <td>get</td>
346
356
  <td>lengthB</td>
347
357
  <td align="center" rowspan="2">None</td>
348
358
  <td rowspan="2">Gets the current buffer size in bits.</td>
@@ -352,7 +362,7 @@ Common functions for setup, movement, manipulation and math shared by both.
352
362
  <td>lenb, sizeB, FileSizeB</td>
353
363
  </tr>
354
364
  <tr>
355
- <td>Name</td>
365
+ <td>get</td>
356
366
  <td>getOffset</td>
357
367
  <td align="center" rowspan="2">None</td>
358
368
  <td rowspan="2">Gets current byte position.</td>
@@ -362,7 +372,7 @@ Common functions for setup, movement, manipulation and math shared by both.
362
372
  <td>off, FTell, tell, saveOffset</td>
363
373
  </tr>
364
374
  <tr>
365
- <td>Name</td>
375
+ <td>get</td>
366
376
  <td>getOffsetBit</td>
367
377
  <td align="center" rowspan="2">None</td>
368
378
  <td rowspan="2">Gets current byte's bit position (0-7).</td>
@@ -372,7 +382,7 @@ Common functions for setup, movement, manipulation and math shared by both.
372
382
  <td>offb, FTellB, tellB, saveOffsetBit</td>
373
383
  </tr>
374
384
  <tr>
375
- <td>Name</td>
385
+ <td>get</td>
376
386
  <td>getOffsetAbsBit</td>
377
387
  <td align="center" rowspan="2">None</td>
378
388
  <td rowspan="2">Gets current absolute bit position from start of data.</td>
@@ -382,7 +392,7 @@ Common functions for setup, movement, manipulation and math shared by both.
382
392
  <td>offab, tellAbsB, saveOffsetAbsBit</td>
383
393
  </tr>
384
394
  <tr>
385
- <td>Name</td>
395
+ <td>get</td>
386
396
  <td>remain</td>
387
397
  <td align="center" rowspan="2">None</td>
388
398
  <td rowspan="2">Size in bytes of current read position to the end.</td>
@@ -392,7 +402,7 @@ Common functions for setup, movement, manipulation and math shared by both.
392
402
  <td>FEoF</td>
393
403
  </tr>
394
404
  <tr>
395
- <td>Name</td>
405
+ <td>get</td>
396
406
  <td>remainB</td>
397
407
  <td align="center" rowspan="2">None</td>
398
408
  <td rowspan="2">Size in bits of current read position to the end.</td>
@@ -402,7 +412,7 @@ Common functions for setup, movement, manipulation and math shared by both.
402
412
  <td>FEoFB</td>
403
413
  </tr>
404
414
  <tr>
405
- <td>Name</td>
415
+ <td>get</td>
406
416
  <td>getLine</td>
407
417
  <td align="center" rowspan="2">None</td>
408
418
  <td rowspan="2">Row line of the file (16 bytes per row).</td>
@@ -412,53 +422,74 @@ Common functions for setup, movement, manipulation and math shared by both.
412
422
  <td>row</td>
413
423
  </tr>
414
424
  <tr>
415
- <td>Name</td>
416
- <td>get</td>
425
+ <td>Function</td>
426
+ <td>get()</td>
417
427
  <td align="center" rowspan="2">None</td>
418
428
  <td rowspan="2">Returns supplied data. <b>Note:</b> Will use .trim() command if extendBufferSize is set (removes all data after current position). Use .data if you want the full padded data buffer.</td>
419
429
  </tr>
420
430
  <tr>
421
- <td>Aliases</td>
422
- <td>return</td>
431
+ <td>get</td>
432
+ <td>return()</td>
423
433
  </tr>
424
434
  <tr>
425
- <td>Name</td>
435
+ <td>get</td>
426
436
  <td>data</td>
427
437
  <td align="center">None</td>
428
438
  <td >Returns full current buffer data.</td>
429
439
  </tr>
430
440
  <tr>
431
- <td>Name</td>
441
+ <td>set</td>
442
+ <td>enforceBigInt = true</td>
443
+ <td align="center">boolean</td>
444
+ <td >If 64 bit reads always return a <code>bigint</code> or a <code>number</code> when possible</td>
445
+ </tr>
446
+ <tr>
447
+ <td>set</td>
448
+ <td>strSettings = {length?, stringType?, terminateValue?, lengthReadSize?, lengthWriteSize?, stripNull?, encoding?, endian?}</td>
449
+ <td>
450
+ <b>length:</b> Length of string for fixed length, non-terminate value utf strings<br/>
451
+ <b>stringType:</b> <code>utf-8</code>, <code>utf-16</code>, <code>pascal</code> or <code>wide-pascal</code>. Default <code>utf-8</code>.<br/>
452
+ <b>terminateValue:</b> Number only with <code>stringType</code> of utf types.<br/>
453
+ <b>lengthReadSize</b> For pascal strings. 1, 2 or 4 byte length read size. Default <code>1</code><br/>
454
+ <b>lengthWriteSize:</b> For pascal strings. 1, 2 or 4 byte length write size. Default <code>1</code>.<br/>
455
+ <b>stripNull:</b> Removes 0x00 characters. default <code>true</code><br/>
456
+ <b>encoding:</b> TextEncoder accepted types. Default <code>utf-8</code>.<br/>
457
+ <b>endian:</b> <code>big</code> or <code>little</code><br/>
458
+ </td>
459
+ <td >Set universal string settings across all string functions.</td>
460
+ </tr>
461
+ <tr>
462
+ <td>Function</td>
432
463
  <td>hexdump({length, startByte, suppressUnicode})</td>
433
464
  <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
465
  <td >Console logs data. Will trigger on error unless turned off (see below)</td>
435
466
  </tr>
436
467
  <tr>
437
- <td>Name</td>
468
+ <td>Function</td>
438
469
  <td>errorDumpOff()</td>
439
470
  <td align="center">None</td>
440
- <td >Does not hexdump on error (default true)</td>
471
+ <td >Does not hexdump on error (default)</td>
441
472
  </tr>
442
473
  <tr>
443
- <td>Name</td>
474
+ <td>Function</td>
444
475
  <td>errorDumpOn()</td>
445
476
  <td align="center">None</td>
446
- <td >Will hexdump on error (default true)</td>
477
+ <td >Turns on hexdump on error</td>
447
478
  </tr>
448
479
  <tr>
449
- <td>Name</td>
480
+ <td>Function</td>
450
481
  <td>unrestrict()</td>
451
482
  <td align="center">None</td>
452
483
  <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
484
  </tr>
454
485
  <tr>
455
- <td>Name</td>
486
+ <td>Function</td>
456
487
  <td>restrict()</td>
457
488
  <td align="center">None</td>
458
489
  <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
490
  </tr>
460
491
  <tr>
461
- <td>Name</td>
492
+ <td>Function</td>
462
493
  <td>end()</td>
463
494
  <td align="center" rowspan="2">None</td>
464
495
  <td rowspan="2">Removes supplied data.</td>
@@ -467,70 +498,107 @@ Common functions for setup, movement, manipulation and math shared by both.
467
498
  <td>Aliases</td>
468
499
  <td>close(), done(), finished()</td>
469
500
  </tr>
501
+ <th align="center" colspan="4"><i>File Control</i></th>
502
+ <tr>
503
+ <td>Function</td>
504
+ <td>open()
505
+ <td align="center"><b>none</td>
506
+ <td>Opens file for reading / writing. Happens at class creation.</td>
507
+ </tr>
508
+ <tr>
509
+ <td>Function</td>
510
+ <td>close()
511
+ <td align="center"><b>none</td>
512
+ <td>Closes file after reading / writing. Note: Commits any edits to the file.</td>
513
+ </tr>
514
+ <tr>
515
+ <td>Function</td>
516
+ <td>commit()
517
+ <td align="center"><b>none</td>
518
+ <td>Commits any edits to data to file.</td>
519
+ </tr>
520
+ <tr>
521
+ <td>Function</td>
522
+ <td>writeMode(writable)
523
+ <td align="center"><b>True if you want to switch to writing in BiReader.</td>
524
+ <td>Note: This changes reader to write mode. Allows file to be expanded in size as well.</td>
525
+ </tr>
526
+ <tr>
527
+ <td>Function</td>
528
+ <td>renameFile(<b>newFilePath</b>)
529
+ <td align="center"><b>Full path to file to rename.</td>
530
+ <td>Renames the file on the file system, keeps read / write position.<br/><br/><b>Note: This is permanent.</b></td>
531
+ </tr>
532
+ <tr>
533
+ <td>Function</td>
534
+ <td>deleteFile()
535
+ <td align="center"><b>none</td>
536
+ <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>
537
+ </tr>
470
538
  <th align="center" colspan="4"><i>Search</i></th>
471
539
  <tr>
472
- <td>Name</td>
540
+ <td>Function</td>
473
541
  <td>findString(<b>value</b>, unsigned, endian)</td>
474
542
  <td align="center">Searches for byte position of string from current read position.</td>
475
543
  <td ><b>Note:</b> Does not change current read position.</td>
476
544
  </tr>
477
545
  <tr>
478
- <td>Name</td>
546
+ <td>Function</td>
479
547
  <td>findByte(<b>value</b>, unsigned, endian)</td>
480
548
  <td align="center">Searches for byte value (can be signed or unsigned) position from current read position.</td>
481
549
  <td ><b>Note:</b> Does not change current read position.</td>
482
550
  </tr>
483
551
  <tr>
484
- <td>Name</td>
552
+ <td>Function</td>
485
553
  <td>findShort(<b>value</b>, unsigned, endian)</td>
486
554
  <td align="center">Searches for short value (can be signed or unsigned) position from current read position.</td>
487
555
  <td ><b>Note:</b> Does not change current read position.</td>
488
556
  </tr>
489
557
  <tr>
490
- <td>Name</td>
558
+ <td>Function</td>
491
559
  <td>findInt(<b>value</b>, unsigned, endian)</td>
492
560
  <td align="center">Searches for integer value (can be signed or unsigned) position from current read position.</td>
493
561
  <td ><b>Note:</b> Does not change current read position.</td>
494
562
  </tr>
495
563
  <tr>
496
- <td>Name</td>
564
+ <td>Function</td>
497
565
  <td>findInt64(<b>value</b>, unsigned, endian)</td>
498
566
  <td align="center">Searches for 64 bit position from current read position.</td>
499
567
  <td ><b>Note:</b> Does not change current read position.</td>
500
568
  </tr>
501
569
  <tr>
502
- <td>Name</td>
570
+ <td>Function</td>
503
571
  <td>findHalfFloat(<b>value</b>, endian)</td>
504
572
  <td align="center">Searches for half float value position from current read position.</td>
505
573
  <td ><b>Note:</b> Does not change current read position.</td>
506
574
  </tr>
507
575
  <tr>
508
- <td>Name</td>
576
+ <td>Function</td>
509
577
  <td>findFloat(<b>value</b>, endian)</td>
510
578
  <td align="center">Searches for float value position from current read position.</td>
511
579
  <td ><b>Note:</b> Does not change current read position.</td>
512
580
  </tr>
513
581
  <tr>
514
- <td>Name</td>
582
+ <td>Function</td>
515
583
  <td>findDoubleFloat(<b>value</b>, endian)</td>
516
584
  <td align="center">Searches for double float value position from current read position.</td>
517
585
  <td ><b>Note:</b> Does not change current read position.</td>
518
586
  </tr>
519
587
  <th align="center" colspan="4"><i>Movement</i></th>
520
588
  <tr>
521
- <td>Name</td>
589
+ <td>Function</td>
522
590
  <td>align(<b>number</b>)</td>
523
591
  <td align="center">Aligns byte position to number.</td>
524
592
  <td ><b>Note:</b> Errors in strict mode when change is outside of data size.</td>
525
593
  </tr>
526
594
  <tr>
527
- <td>Name</td>
595
+ <td>Function</td>
528
596
  <td>alignRev(<b>number</b>)</td>
529
597
  <td align="center">Reverse aligns byte position to number.</td>
530
598
  <td ><b>Note:</b> Errors in strict mode when change is outside of data size.</td>
531
599
  </tr>
532
600
  <tr>
533
- <td>Name</td>
601
+ <td>Function</td>
534
602
  <td>skip(<b>bytes</b>, bits)</td>
535
603
  <td align="center" rowspan="2"><b>Bytes to skip from current byte position</b>, bits to skip (default 0)</td>
536
604
  <td rowspan="2">Use negative to go back.<br><b>Note:</b> Remaining bits are dropped when returning to a byte function.</td>
@@ -540,7 +608,7 @@ Common functions for setup, movement, manipulation and math shared by both.
540
608
  <td>FSeek(<b>byte</b>, bit)<br>seek(<b>byte</b>, bit)<br>jump(<b>bytes</b>, bits)</td>
541
609
  </tr>
542
610
  <tr>
543
- <td>Name</td>
611
+ <td>Function</td>
544
612
  <td>goto(<b>byte</b>, bit)</td>
545
613
  <td align="center" rowspan="2"><b>Byte offset from start</b>, bit offset from byte offset</td>
546
614
  <td rowspan="2"><b>Note:</b> Remaining bits are drop when returning to byte function.</td>
@@ -550,7 +618,7 @@ Common functions for setup, movement, manipulation and math shared by both.
550
618
  <td>pointer(<b>byte</b>, bit)<br>warp(<b>byte</b>, bit)</td>
551
619
  </tr>
552
620
  <tr>
553
- <td>Name</td>
621
+ <td>Function</td>
554
622
  <td>rewind()</td>
555
623
  <td align="center" rowspan="2">None</td>
556
624
  <td rowspan="2">Moves current byte position to start of data.</td>
@@ -560,7 +628,7 @@ Common functions for setup, movement, manipulation and math shared by both.
560
628
  <td>gotoStart()</td>
561
629
  </tr>
562
630
  <tr>
563
- <td>Name</td>
631
+ <td>Function</td>
564
632
  <td>last()</td>
565
633
  <td align="center" rowspan="2">None</td>
566
634
  <td rowspan="2">Moves current byte position to end of data.</td>
@@ -571,13 +639,13 @@ Common functions for setup, movement, manipulation and math shared by both.
571
639
  </tr>
572
640
  <th align="center" colspan="4"><i>Manipulation</i></th>
573
641
  <tr>
574
- <td>Name</td>
642
+ <td>Function</td>
575
643
  <td>delete(startOffset, endOffset, consume)</td>
576
644
  <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
645
  <td >Removes and returns data. <br><b>Note:</b> Errors on strict mode</td>
578
646
  </tr>
579
647
  <tr>
580
- <td>Name</td>
648
+ <td>Function</td>
581
649
  <td>clip()</td>
582
650
  <td align="center" rowspan="2">None</td>
583
651
  <td rowspan="2">Removes data after the current byte position and returns data. <br><b>Note:</b> Errors on strict mode</td>
@@ -587,7 +655,7 @@ Common functions for setup, movement, manipulation and math shared by both.
587
655
  <td>trim()</td>
588
656
  </tr>
589
657
  <tr>
590
- <td>Name</td>
658
+ <td>Function</td>
591
659
  <td>crop(<b>length</b>, consume)</td>
592
660
  <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
661
  <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,7 +665,7 @@ Common functions for setup, movement, manipulation and math shared by both.
597
665
  <td>drop(<b>length</b>, consume)</td>
598
666
  </tr>
599
667
  <tr>
600
- <td>Name</td>
668
+ <td>Function</td>
601
669
  <td>replace(<b>data</b>, consume, offset)</td>
602
670
  <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
671
  <td rowspan="2">Replaces data at current byte or supplied offset.<br><b>Note:</b> Errors on strict mode</td>
@@ -607,7 +675,7 @@ Common functions for setup, movement, manipulation and math shared by both.
607
675
  <td>writeBytes(values, unsigned), overwrite(<b>data</b>, consume, offset)</td>
608
676
  </tr>
609
677
  <tr>
610
- <td>Name</td>
678
+ <td>Function</td>
611
679
  <td>lift(startByte, endByte, consume, fillValue)</td>
612
680
  <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
681
  <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 +685,7 @@ Common functions for setup, movement, manipulation and math shared by both.
617
685
  <td>fill(startByte, endByte, consume, fillValue)</td>
618
686
  </tr>
619
687
  <tr>
620
- <td>Name</td>
688
+ <td>Function</td>
621
689
  <td>extract(<b>length</b>, consume)</td>
622
690
  <td align="center" rowspan="2"><b>Number of bytes to read</b>, move byte position to after data read (default false)</td>
623
691
  <td rowspan="2">Returns data from current byte position for length of data</b>.</td>
@@ -627,17 +695,17 @@ Common functions for setup, movement, manipulation and math shared by both.
627
695
  <td>readbytes(amount, unsigned), slice(<b>length</b>, consume)<br>wrap(<b>length</b>, consume)</td>
628
696
  </tr>
629
697
  <tr>
630
- <td>Name</td>
698
+ <td>Function</td>
631
699
  <td>insert(<b>data</b>, consume, offset)</td>
632
700
  <td align="center" rowspan="2"><b>New data to insert</b>, move byte position to after data read (default false), byte position to insert (default current byte position)</td>
633
701
  <td rowspan="2">Inserts new data into supplied data. <b>Note:</b> Data type must match supplied data. Errors on strict mode</td>
634
702
  </tr>
635
703
  <tr>
636
704
  <td>Aliases</td>
637
- <td>place(<b>data</b>, consume, offset)</td>
705
+ <td>place(<b>data</b>, consume, offset), write(<b>data</b>, consume, offset)</td>
638
706
  </tr>
639
707
  <tr>
640
- <td>Name</td>
708
+ <td>Function</td>
641
709
  <td>unshift(<b>data</b>, consume)</td>
642
710
  <td align="center" rowspan="2"><b>New data to insert</b>, move byte position to after data read (default false)</td>
643
711
  <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 +715,9 @@ Common functions for setup, movement, manipulation and math shared by both.
647
715
  <td>prepend(<b>data</b>, consume)</td>
648
716
  </tr>
649
717
  <tr>
650
- <td>Name</td>
651
- <td>push(<b>length</b>, consume)</td>
652
- <td align="center" rowspan="2"><b>Number</b>, move byte position to after data read (default false)</td>
718
+ <td>Function</td>
719
+ <td>push(<b>data</b>, consume)</td>
720
+ <td align="center" rowspan="2"><b>New data to insert</b>, move byte position to after data read (default false)</td>
653
721
  <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
722
  </tr>
655
723
  <tr>
@@ -658,85 +726,85 @@ Common functions for setup, movement, manipulation and math shared by both.
658
726
  </tr>
659
727
  <th align="center" colspan="4"><i>Math</i></th>
660
728
  <tr>
661
- <td>Name</td>
729
+ <td>Function</td>
662
730
  <td>xor(<b>xorKey</b>, startOffset, endOffset, consume)
663
731
  <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
732
  <td >XOR data. <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
665
733
  </tr>
666
734
  <tr>
667
- <td>Name</td>
735
+ <td>Function</td>
668
736
  <td>xorThis(<b>xorKey</b>, length, consume)
669
737
  <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
738
  <td>XOR data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
671
739
  </tr>
672
740
  <tr>
673
- <td>Name</td>
741
+ <td>Function</td>
674
742
  <td>or(<b>orKey</b>, startOffset, endOffset, consume)
675
743
  <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
744
  <td >OR data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
677
745
  </tr>
678
746
  <tr>
679
- <td>Name</td>
747
+ <td>Function</td>
680
748
  <td>orThis(<b>orKey</b>, length, consume)
681
749
  <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
750
  <td>OR data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
683
751
  </tr>
684
752
  <tr>
685
- <td>Name</td>
753
+ <td>Function</td>
686
754
  <td>and(<b>andKey</b>, startOffset, endOffset, consume)
687
755
  <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
756
  <td >AND data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
689
757
  </tr>
690
758
  <tr>
691
- <td>Name</td>
759
+ <td>Function</td>
692
760
  <td>andThis(<b>andKey</b>, length, consume)
693
761
  <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
762
  <td>AND data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
695
763
  </tr>
696
764
  <tr>
697
- <td>Name</td>
765
+ <td>Function</td>
698
766
  <td>add(<b>addKey</b>, startOffset, endOffset, consume)
699
767
  <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
768
  <td >Add value to data (per byte). <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
701
769
  </tr>
702
770
  <tr>
703
- <td>Name</td>
771
+ <td>Function</td>
704
772
  <td>addThis(<b>addKey</b>, length, consume)
705
773
  <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
774
  <td>Add value to data (per byte)</td>
707
775
  </tr>
708
776
  <tr>
709
- <td>Name</td>
777
+ <td>Function</td>
710
778
  <td>not(startOffset, endOffset, consume)
711
779
  <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
780
  <td >NOT data (per byte)</td>
713
781
  </tr>
714
782
  <tr>
715
- <td>Name</td>
783
+ <td>Function</td>
716
784
  <td>notThis(length, consume)
717
785
  <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
786
  <td>NOT data (per byte)</td>
719
787
  </tr>
720
788
  <tr>
721
- <td>Name</td>
789
+ <td>Function</td>
722
790
  <td>lShift(<b>shiftKey</b>, startOffset, endOffset, consume)
723
791
  <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
792
  <td >Left shift data (per byte). <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
725
793
  </tr>
726
794
  <tr>
727
- <td>Name</td>
795
+ <td>Function</td>
728
796
  <td>lShiftThis(<b>shiftKey</b>, length, consume)
729
797
  <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
798
  <td>Left shift data (per byte)</td>
731
799
  </tr>
732
800
  <tr>
733
- <td>Name</td>
801
+ <td>Function</td>
734
802
  <td>rShift(<b>shiftKey</b>, startOffset, endOffset, consume)
735
803
  <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
804
  <td >Right shift data (per byte). <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
737
805
  </tr>
738
806
  <tr>
739
- <td>Name</td>
807
+ <td>Function</td>
740
808
  <td>rShiftThis(<b>shiftKey</b>, length, consume)
741
809
  <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
810
  <td>Right shift data (per byte)</td>
@@ -744,62 +812,137 @@ Common functions for setup, movement, manipulation and math shared by both.
744
812
  </tbody>
745
813
  </table>
746
814
 
747
- ## BiStreams
815
+ ## Async
816
+
817
+ With 4.0 you can now use ``BiReaderAsync`` and ``BiWriterAsync`` for async operations. Pass a normal Buffer or Uint8Array to it or read from a file when passed a string path (only in Node.js). When passed a Buffer or Uint8Array, it's the same logic as the sync class. 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.
748
818
 
749
- With 3.1 you can now use ``BiReaderStream`` and ``BiWriterStream`` (Node.js only) designed for larger files (or if you don't want to or need to load the whole file loaded to memory all at once).
819
+ **Naming:** Same function naming applies to async as [Common Functions](#common-functions) section but this class is all async functions. ``BiReader`` and ``BiWriter`` are interchangeable when it comes to all functions and class objects names but get and set methods are now also async functions.
750
820
 
751
- **Programmers Note:** These are *NOT* data streams like ``fs.createReadStream`` where the whole file is streamed over time. It uses ``fs.openSync`` and ``fs.readSync`` and ``fs.writeSync`` to read and write just the data requested at the position requested at the time of operation, saving memory but costing processing power. This is mostly for legacy uses and niche cases as the newer versions of the Node.js have a much larger Buffer size over the older 4gig limit.
821
+ **Writing:** When operating a file, **all write functions will throw an error unless you switch to `.writeMode(true)`**. The file is read only in ``BiReaderAsync`` until you do (``BiWriterAsync`` is true). Any write functions inside the reader size will error beforehand.
822
+
823
+ **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.**
824
+
825
+ **Programmers Note:** The buffer data within these classes is always the last read or write command when operating a file. These classes do NOT load the whole file. Use the ``BiReader`` and ``BiWriter`` for that.
752
826
 
753
827
  <table>
754
828
  <thead>
755
829
  <tr>
756
- <th align="center" colspan="2">Function</th>
830
+ <th align="center" colspan="2">Methods</th>
757
831
  <th align="center">Params (bold requires)</th>
758
832
  <th align="left">Desc</th>
759
833
  </tr>
760
834
  </thead>
761
835
  <tbody>
762
836
  <tr>
763
- <th align="center" colspan="4"><i>Streaming</i></th>
837
+ <td>Class</td>
838
+ <td>new BiReaderAsync(<b>dataOrFilePath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize, writeable})</td>
839
+ <td align="center" rowspan="2"><b>Path to file or Buffer or Uint8Array</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, edit the file (default true in BiWriterAsync).
840
+ </td>
841
+ <td rowspan="2">Start with new Constructor.<br><br><b>Note:</b> The file must be opened with <b>await .open()</b> and closed with <b>await .close()</b>. The <b>.data</b> value is always the Buffer to the last read or write value. Read sizes outside of Node's max size will error, unless remove then it will create a new file.<br><br><b>Writer note:</b> You can set the <b>extendBufferSize</b> value to always extend the file by this minimum amount when reaching the end of the file. The file is saved after every write.</td>
842
+ </tr>
843
+ <tr>
844
+ <td>Class</td>
845
+ <td>new BiWriterAsync(<b>dataOrFilePath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize, writeable})</td>
846
+ </tr>
847
+ <th align="center" colspan="4"><i>File Control</i></th>
848
+ <tr>
849
+ <td>Async</td>
850
+ <td>open()
851
+ <td align="center"><b>none</td>
852
+ <td>Opens file for reading / writing.</td>
853
+ </tr>
854
+ <tr>
855
+ <td>Async</td>
856
+ <td>close()
857
+ <td align="center"><b>none</td>
858
+ <td>Closes file after reading / writing.</td>
859
+ </tr>
860
+ <tr>
861
+ <td>Async</td>
862
+ <td>create(<b>dataOrFilePath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize, writeable})</td>
863
+ <td align="center"><b>Path to file or Buffer or Uint8Array</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, edit the file (default true in BiWriterAsync).</td>
864
+ <td>Creates a new class and opens the file.</td>
865
+ </tr>
764
866
  <tr>
867
+ <td>Function</td>
868
+ <td>writeMode(writable)
869
+ <td align="center"><b>True</b> if you want to switch to writing in BiReaderLegacy.</td>
870
+ <td>Note: This changes reader to write mode. Allows file to be expanded in size as well.</td>
871
+ </tr>
765
872
  <tr>
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.
873
+ <td>Async</td>
874
+ <td>renameFile(<b>newFilePath</b>)
875
+ <td align="center"><b>Full path to file to rename.</td>
876
+ <td>Renames the file on the file system, keeps read / write position.<br/><br/><b>Note: This is permanent.</b></td>
877
+ </tr>
878
+ <tr>
879
+ <td>Async</td>
880
+ <td>deleteFile()
881
+ <td align="center"><b>none</td>
882
+ <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>
883
+ </tr>
884
+ </tbody>
885
+ </table>
886
+
887
+ ## BiLegacy
888
+
889
+ With 4.0 you can now use ``BiReaderLegacy`` and ``BiWriterLegacy`` (old ``BiStreamReader`` and ``BiStreamWriter``) for older versions of Node.js only. It's designed for larger files where you can't or don't want to load the whole file buffer into memory all at once.
890
+
891
+ **Naming:** Same function naming applies to legacy as [Common Functions](#common-functions) section but this class saves the file after every operation. **BiReaderLegacy / BiReader** and **BiWriterLegacy / BiWriter** are interchangeable when it comes to all functions and class objects names for easy use with Typescript.
892
+
893
+ **Writing:** Unlike the other classes, **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.
894
+
895
+ **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.**
896
+
897
+ **Programmers Note:** These are *NOT* async function (use [Async](#async) classes for that) or streamed over time like ``fs.createReadStream``. It uses ``fs.openSync`` and ``fs.readSync`` and ``fs.writeSync`` to read and write just the data requested at the position requested at the time of operation, saving memory but costing processing power. This is for legacy systems and niche cases as the newer versions of Node.js have a much larger file buffers over the older limits.
898
+
899
+ <table>
900
+ <thead>
901
+ <tr>
902
+ <th align="center" colspan="2">Methods</th>
903
+ <th align="center">Params (bold requires)</th>
904
+ <th align="left">Desc</th>
905
+ </tr>
906
+ </thead>
907
+ <tbody>
908
+ <tr>
909
+ <td>Class</td>
910
+ <td>new BiReaderLegacy(<b>filePath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize, writeable})</td>
911
+ <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, edit the file (default true in BiWriterLegacy).
769
912
  </td>
770
913
  <td rowspan="2">Start with new Constructor.<br><br><b>Note:</b> The file must be opened with <b>.open()</b> and closed with <b>.close()</b>. The <b>.data</b> value is always the Buffer to the last read or write value. Read sizes outside of Node's max size will error, unless remove then it will create a new file.<br><br><b>Writer note:</b> You can set the <b>extendBufferSize</b> value to always extend the file by this minimum amount when reaching the end of the file. The file is saved after every write.</td>
771
914
  </tr>
772
915
  <tr>
773
- <td>Name</td>
774
- <td>new BiWriterStream(<b>filePath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize})</td>
916
+ <td>Class</td>
917
+ <td>new BiWriterLegacy(<b>filePath</b>, {byteOffset, bitOffset, endianess, strict, extendBufferSize, writeable})</td>
775
918
  </tr>
776
919
  <th align="center" colspan="4"><i>File Control</i></th>
777
920
  <tr>
778
- <td>Name</td>
921
+ <td>Function</td>
779
922
  <td>open()
780
923
  <td align="center"><b>none</td>
781
924
  <td>Opens file for reading / writing.</td>
782
925
  </tr>
783
926
  <tr>
784
- <td>Name</td>
927
+ <td>Function</td>
785
928
  <td>close()
786
929
  <td align="center"><b>none</td>
787
930
  <td>Closes file after reading / writing.</td>
788
931
  </tr>
789
932
  <tr>
790
- <td>Name</td>
933
+ <td>Function</td>
791
934
  <td>writeMode(writable)
792
- <td align="center"><b>True if you want to switch to writing in BiReaderStream.</td>
935
+ <td align="center"><b>True if you want to switch to writing in BiReaderLegacy.</td>
793
936
  <td>Note: This changes reader to write mode. Allows file to be expanded in size as well.</td>
794
937
  </tr>
795
938
  <tr>
796
- <td>Name</td>
939
+ <td>Function</td>
797
940
  <td>renameFile(<b>newFilePath</b>)
798
941
  <td align="center"><b>Full path to file to rename.</td>
799
942
  <td>Renames the file on the file system, keeps read / write position.<br/><br/><b>Note: This is permanent.</b></td>
800
943
  </tr>
801
944
  <tr>
802
- <td>Name</td>
945
+ <td>Function</td>
803
946
  <td>deleteFile()
804
947
  <td align="center"><b>none</td>
805
948
  <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>
@@ -807,17 +950,11 @@ With 3.1 you can now use ``BiReaderStream`` and ``BiWriterStream`` (Node.js only
807
950
  </tbody>
808
951
  </table>
809
952
 
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
953
  ## Bit field
817
954
 
818
- 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).
955
+ 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
956
 
820
- **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.
957
+ **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
958
 
822
959
  <table>
823
960
  <thead>
@@ -840,19 +977,19 @@ Parse value as a bit field. There are 32 functions from bit1 to bit32 and can be
840
977
  <tr>
841
978
  <td align="center"><b>Presets (reader)</b></td>
842
979
  <td>[u]bit{1-32}{le|be}</td>
843
- <td>*Note: in BiReader these are get, not functions.</td>
980
+ <td>*Note: In BiReader these are get, not functions.</td>
844
981
  </tr>
845
982
  <tr>
846
983
  <td align="center"><b>Presets (writer)</b></td>
847
984
  <td>[u]bit{1-32}{le|be} = <b>value</b></td>
848
- <td>*Note: in BiWriter these are set, not functions.</td>
985
+ <td>*Note: In BiWriter these are set, not functions.</td>
849
986
  </tr>
850
987
  </tbody>
851
988
  </table>
852
989
 
853
990
  ## Byte
854
991
 
855
- Parse value as a byte (aka int8). Can be signed or unsigned (with a ``u`` at the start).
992
+ Parse value as a byte (aka int8). Can be signed or unsigned (with a `u` at the start).
856
993
 
857
994
  <table>
858
995
  <thead>
@@ -887,7 +1024,7 @@ Parse value as a byte (aka int8). Can be signed or unsigned (with a ``u`` at the
887
1024
 
888
1025
  ## Short
889
1026
 
890
- 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).
1027
+ 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
1028
 
892
1029
  <table>
893
1030
  <thead>
@@ -922,7 +1059,7 @@ Parse value as a int16 (aka short or word). Can be signed or unsigned (with a ``
922
1059
 
923
1060
  ## Half Float
924
1061
 
925
- Parse value as a half float (aka half). Can be in little or big endian order (``be`` or ``le`` at the end).
1062
+ Parse value as a half float (aka half). Can be in little or big endian order (`be` or `le` at the end).
926
1063
 
927
1064
  <table>
928
1065
  <thead>
@@ -957,7 +1094,7 @@ Parse value as a half float (aka half). Can be in little or big endian order (``
957
1094
 
958
1095
  ## Integer
959
1096
 
960
- 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).
1097
+ 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
1098
 
962
1099
  <table>
963
1100
  <thead>
@@ -992,7 +1129,7 @@ Parse value as a int32 (aka int, long or double). Can be signed or unsigned (wi
992
1129
 
993
1130
  ## Float
994
1131
 
995
- Parse value as a float. Can be in little or big endian order (``be`` or ``le`` at the end).
1132
+ Parse value as a float. Can be in little or big endian order (`be` or `le` at the end).
996
1133
 
997
1134
  <table>
998
1135
  <thead>
@@ -1027,7 +1164,7 @@ Parse value as a float. Can be in little or big endian order (``be`` or ``le`` a
1027
1164
 
1028
1165
  ## Quadword
1029
1166
 
1030
- 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).
1167
+ 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
1168
 
1032
1169
  <table>
1033
1170
  <thead>
@@ -1062,7 +1199,7 @@ Parse value as a int64 (aka quad or bigint). Can be signed or unsigned (with a `
1062
1199
 
1063
1200
  ## Double Float
1064
1201
 
1065
- Parse value as a double float (aka dfloat). Can be in little or big endian order (``be`` or ``le`` at the end).
1202
+ Parse value as a double float (aka dfloat). Can be in little or big endian order (`be` or `le` at the end).
1066
1203
 
1067
1204
  <table>
1068
1205
  <thead>
@@ -1097,11 +1234,10 @@ Parse value as a double float (aka dfloat). Can be in little or big endian order
1097
1234
 
1098
1235
  ## Strings
1099
1236
 
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 ``be`` or ``le`` at the end for little or big endian.
1237
+ 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 `be` or `le` at the end for little or big endian.
1101
1238
 
1102
1239
  Presents include C or Unicode, Ansi and multiple pascals.
1103
1240
 
1104
-
1105
1241
  <table>
1106
1242
  <thead>
1107
1243
  <tr>