bireader 4.0.1 → 4.0.3
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/dist/{index.d.ts → cjs/index.d.ts} +181 -220
- package/dist/{index.cjs.js → cjs/index.js} +100 -155
- package/dist/cjs/index.js.map +1 -0
- package/dist/{index.browser.d.ts → esm/indexBrowser.d.ts} +189 -228
- package/dist/{index.browser.js → esm/indexBrowser.js} +1393 -1406
- package/dist/esm/indexBrowser.js.map +1 -0
- package/dist/{index.cjs.d.ts → esm/indexImport.d.ts} +178 -217
- package/dist/{index.esm.js → esm/indexImport.js} +1369 -1389
- package/dist/esm/indexImport.js.map +1 -0
- package/package.json +16 -22
- package/_test_reader.cjs +0 -38
- package/_test_writer.mjs +0 -8
- package/dist/index.browser.js.map +0 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.d.ts +0 -13408
- package/dist/index.esm.js.map +0 -1
- package/rollup.config.mjs +0 -81
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as fs_promises from 'fs/promises';
|
|
2
|
-
|
|
3
1
|
type endian = "little" | "big";
|
|
4
2
|
type BigValue = number | bigint;
|
|
5
|
-
type
|
|
3
|
+
type ReturnMapping<DataType> = DataType extends string | Buffer ? Buffer : Uint8Array;
|
|
4
|
+
type ReturnBigValueMapping<alwaysBigInt> = alwaysBigInt extends true ? bigint : BigValue;
|
|
5
|
+
type BiOptions<alwaysBigInt> = {
|
|
6
6
|
/**
|
|
7
7
|
* Byte offset to start, default is 0
|
|
8
8
|
*/
|
|
@@ -28,7 +28,7 @@ type BiOptions = {
|
|
|
28
28
|
*
|
|
29
29
|
* Set this to ``true`` if you wish for it to always stay a ``BigInt``.
|
|
30
30
|
*/
|
|
31
|
-
enforceBigInt?:
|
|
31
|
+
enforceBigInt?: alwaysBigInt;
|
|
32
32
|
/**
|
|
33
33
|
* If you want to prevent write operations
|
|
34
34
|
*/
|
|
@@ -116,7 +116,7 @@ declare function hexdump(src: Uint8Array | Buffer, options?: hexdumpOptions): vo
|
|
|
116
116
|
/**
|
|
117
117
|
* Base class for BiReader and BiWriter
|
|
118
118
|
*/
|
|
119
|
-
declare class BiBase<DataType
|
|
119
|
+
declare class BiBase<DataType, alwaysBigInt> {
|
|
120
120
|
#private;
|
|
121
121
|
/**
|
|
122
122
|
* Endianness of default read.
|
|
@@ -180,9 +180,9 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
180
180
|
/**
|
|
181
181
|
* Get the current buffer data.
|
|
182
182
|
*
|
|
183
|
-
* @type {DataType}
|
|
183
|
+
* @type {ReturnMapping<DataType>}
|
|
184
184
|
*/
|
|
185
|
-
get data(): DataType
|
|
185
|
+
get data(): ReturnMapping<DataType>;
|
|
186
186
|
/**
|
|
187
187
|
* Set the current buffer data.
|
|
188
188
|
*
|
|
@@ -194,7 +194,7 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
194
194
|
* Get the DataView of current buffer data.
|
|
195
195
|
*/
|
|
196
196
|
get view(): DataView<ArrayBufferLike>;
|
|
197
|
-
constructor(input?:
|
|
197
|
+
constructor(input?: DataType, options?: BiOptions<alwaysBigInt>);
|
|
198
198
|
/**
|
|
199
199
|
* Settings for when using .str
|
|
200
200
|
*
|
|
@@ -224,15 +224,15 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
224
224
|
*
|
|
225
225
|
* Can be used to pass new data to a loaded class, shifting to memory mode.
|
|
226
226
|
*/
|
|
227
|
-
open(data?: DataType): void;
|
|
227
|
+
open(data?: ReturnMapping<DataType>): void;
|
|
228
228
|
/**
|
|
229
229
|
* commit data and removes it.
|
|
230
230
|
*/
|
|
231
|
-
close(): DataType
|
|
231
|
+
close(): ReturnMapping<DataType>;
|
|
232
232
|
/**
|
|
233
233
|
* Write data buffer back to file
|
|
234
234
|
*/
|
|
235
|
-
commit(): DataType
|
|
235
|
+
commit(): ReturnMapping<DataType>;
|
|
236
236
|
/**
|
|
237
237
|
* syncs the data to file
|
|
238
238
|
*/
|
|
@@ -547,9 +547,9 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
547
547
|
*
|
|
548
548
|
* Use ``.data`` instead if you want the full buffer data.
|
|
549
549
|
*
|
|
550
|
-
* @returns {DataType} ``Buffer`` or ``Uint8Array``
|
|
550
|
+
* @returns {ReturnMapping<DataType>} ``Buffer`` or ``Uint8Array``
|
|
551
551
|
*/
|
|
552
|
-
get(): DataType
|
|
552
|
+
get(): ReturnMapping<DataType>;
|
|
553
553
|
/**
|
|
554
554
|
* Returns current data.
|
|
555
555
|
*
|
|
@@ -557,9 +557,9 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
557
557
|
*
|
|
558
558
|
* Use ``.data`` instead if you want the full buffer data.
|
|
559
559
|
*
|
|
560
|
-
* @returns {DataType} ``Buffer`` or ``Uint8Array``
|
|
560
|
+
* @returns {ReturnMapping<DataType>} ``Buffer`` or ``Uint8Array``
|
|
561
561
|
*/
|
|
562
|
-
getFullBuffer(): DataType
|
|
562
|
+
getFullBuffer(): ReturnMapping<DataType>;
|
|
563
563
|
/**
|
|
564
564
|
* Returns current data.
|
|
565
565
|
*
|
|
@@ -567,27 +567,27 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
567
567
|
*
|
|
568
568
|
* Use ``.data`` instead if you want the full buffer data.
|
|
569
569
|
*
|
|
570
|
-
* @returns {DataType} ``Buffer`` or ``Uint8Array``
|
|
570
|
+
* @returns {ReturnMapping<DataType>} ``Buffer`` or ``Uint8Array``
|
|
571
571
|
*/
|
|
572
|
-
return(): DataType
|
|
572
|
+
return(): ReturnMapping<DataType>;
|
|
573
573
|
/**
|
|
574
574
|
* Returns and remove data.
|
|
575
575
|
*
|
|
576
576
|
* Commits any changes to file when editing a file.
|
|
577
577
|
*/
|
|
578
|
-
end(): DataType
|
|
578
|
+
end(): ReturnMapping<DataType>;
|
|
579
579
|
/**
|
|
580
580
|
* removes data.
|
|
581
581
|
*
|
|
582
582
|
* Commits any changes to file when editing a file.
|
|
583
583
|
*/
|
|
584
|
-
done(): DataType
|
|
584
|
+
done(): ReturnMapping<DataType>;
|
|
585
585
|
/**
|
|
586
586
|
* removes data.
|
|
587
587
|
*
|
|
588
588
|
* Commits any changes to file when editing a file.
|
|
589
589
|
*/
|
|
590
|
-
finished(): DataType
|
|
590
|
+
finished(): ReturnMapping<DataType>;
|
|
591
591
|
/**
|
|
592
592
|
* Creates hex dump string. Will console log or return string if set in options.
|
|
593
593
|
*
|
|
@@ -868,21 +868,21 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
868
868
|
*
|
|
869
869
|
* Note: Errors on strict mode if past end of data.
|
|
870
870
|
*
|
|
871
|
-
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
871
|
+
* @param {ReturnMapping<DataType>} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
872
872
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
873
873
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
874
874
|
*/
|
|
875
|
-
replace(data: DataType
|
|
875
|
+
replace(data: ReturnMapping<DataType>, offset?: number, consume?: boolean): void;
|
|
876
876
|
/**
|
|
877
877
|
* Replaces data in data.
|
|
878
878
|
*
|
|
879
879
|
* Note: Errors on strict mode.
|
|
880
880
|
*
|
|
881
|
-
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
881
|
+
* @param {ReturnMapping<DataType>} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
882
882
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
883
883
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
884
884
|
*/
|
|
885
|
-
overwrite(data: DataType
|
|
885
|
+
overwrite(data: ReturnMapping<DataType>, offset?: number, consume?: boolean): void;
|
|
886
886
|
/**
|
|
887
887
|
* Returns part of data from current byte position to end of data unless supplied.
|
|
888
888
|
*
|
|
@@ -938,57 +938,57 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
938
938
|
*
|
|
939
939
|
* Note: Errors on strict mode.
|
|
940
940
|
*
|
|
941
|
-
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
941
|
+
* @param {ReturnMapping<DataType>} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
942
942
|
* @param {number} offset - Byte position to add at (defaults to current position)
|
|
943
943
|
* @param {boolean} consume - Move current byte position to end of data (default true)
|
|
944
944
|
*/
|
|
945
|
-
insert(data: DataType
|
|
945
|
+
insert(data: ReturnMapping<DataType>, offset?: number, consume?: boolean): void;
|
|
946
946
|
/**
|
|
947
947
|
* Inserts data into data.
|
|
948
948
|
*
|
|
949
949
|
* Note: Errors on strict mode.
|
|
950
950
|
*
|
|
951
|
-
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
951
|
+
* @param {ReturnMapping<DataType>} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
952
952
|
* @param {number} offset - Byte position to add at (defaults to current position)
|
|
953
953
|
* @param {boolean} consume - Move current byte position to end of data (default true)
|
|
954
954
|
*/
|
|
955
|
-
place(data: DataType
|
|
955
|
+
place(data: ReturnMapping<DataType>, offset?: number, consume?: boolean): void;
|
|
956
956
|
/**
|
|
957
957
|
* Adds data to start of supplied data.
|
|
958
958
|
*
|
|
959
959
|
* Note: Errors on strict mode.
|
|
960
960
|
*
|
|
961
|
-
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
961
|
+
* @param {ReturnMapping<DataType>} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
962
962
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
963
963
|
*/
|
|
964
|
-
unshift(data: DataType
|
|
964
|
+
unshift(data: ReturnMapping<DataType>, consume?: boolean): void;
|
|
965
965
|
/**
|
|
966
966
|
* Adds data to start of supplied data.
|
|
967
967
|
*
|
|
968
968
|
* Note: Errors on strict mode.
|
|
969
969
|
*
|
|
970
|
-
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
970
|
+
* @param {ReturnMapping<DataType>} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
971
971
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
972
972
|
*/
|
|
973
|
-
prepend(data: DataType
|
|
973
|
+
prepend(data: ReturnMapping<DataType>, consume?: boolean): void;
|
|
974
974
|
/**
|
|
975
975
|
* Adds data to end of supplied data.
|
|
976
976
|
*
|
|
977
977
|
* Note: Errors on strict mode.
|
|
978
978
|
*
|
|
979
|
-
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
979
|
+
* @param {ReturnMapping<DataType>} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
980
980
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
981
981
|
*/
|
|
982
|
-
push(data: DataType
|
|
982
|
+
push(data: ReturnMapping<DataType>, consume?: boolean): void;
|
|
983
983
|
/**
|
|
984
984
|
* Adds data to end of supplied data.
|
|
985
985
|
*
|
|
986
986
|
* Note: Errors on strict mode.
|
|
987
987
|
*
|
|
988
|
-
* @param {DataType} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
988
|
+
* @param {ReturnMapping<DataType>} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
989
989
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
990
990
|
*/
|
|
991
|
-
append(data: DataType
|
|
991
|
+
append(data: ReturnMapping<DataType>, consume?: boolean): void;
|
|
992
992
|
/**
|
|
993
993
|
* XOR data.
|
|
994
994
|
*
|
|
@@ -1621,47 +1621,47 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
1621
1621
|
* @param {endian} endian - ``big`` or ``little``
|
|
1622
1622
|
* @param {boolean} consume - move offset after read
|
|
1623
1623
|
*/
|
|
1624
|
-
readInt64(unsigned?: boolean, endian?: endian, consume?: boolean): alwaysBigInt
|
|
1624
|
+
readInt64(unsigned?: boolean, endian?: endian, consume?: boolean): ReturnBigValueMapping<alwaysBigInt>;
|
|
1625
1625
|
/**
|
|
1626
1626
|
* Read unsigned 64 bit integer.
|
|
1627
1627
|
*
|
|
1628
1628
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
1629
1629
|
*
|
|
1630
|
-
* @returns {
|
|
1630
|
+
* @returns {ReturnBigValueMapping<alwaysBigInt>}
|
|
1631
1631
|
*/
|
|
1632
|
-
readUInt64(): alwaysBigInt
|
|
1632
|
+
readUInt64(): ReturnBigValueMapping<alwaysBigInt>;
|
|
1633
1633
|
/**
|
|
1634
1634
|
* Read signed 64 bit integer.
|
|
1635
1635
|
*
|
|
1636
1636
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
1637
1637
|
*
|
|
1638
|
-
* @returns {
|
|
1638
|
+
* @returns {ReturnBigValueMapping<alwaysBigInt>}
|
|
1639
1639
|
*/
|
|
1640
|
-
readInt64BE(): alwaysBigInt
|
|
1640
|
+
readInt64BE(): ReturnBigValueMapping<alwaysBigInt>;
|
|
1641
1641
|
/**
|
|
1642
1642
|
* Read signed 64 bit integer.
|
|
1643
1643
|
*
|
|
1644
1644
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
1645
1645
|
*
|
|
1646
|
-
* @returns {
|
|
1646
|
+
* @returns {ReturnBigValueMapping<alwaysBigInt>}
|
|
1647
1647
|
*/
|
|
1648
|
-
readInt64LE(): alwaysBigInt
|
|
1648
|
+
readInt64LE(): ReturnBigValueMapping<alwaysBigInt>;
|
|
1649
1649
|
/**
|
|
1650
1650
|
* Read unsigned 64 bit integer.
|
|
1651
1651
|
*
|
|
1652
1652
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
1653
1653
|
*
|
|
1654
|
-
* @returns {
|
|
1654
|
+
* @returns {ReturnBigValueMapping<alwaysBigInt>}
|
|
1655
1655
|
*/
|
|
1656
|
-
readUInt64BE(): alwaysBigInt
|
|
1656
|
+
readUInt64BE(): ReturnBigValueMapping<alwaysBigInt>;
|
|
1657
1657
|
/**
|
|
1658
1658
|
* Read unsigned 64 bit integer.
|
|
1659
1659
|
*
|
|
1660
1660
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
1661
1661
|
*
|
|
1662
|
-
* @returns {
|
|
1662
|
+
* @returns {ReturnBigValueMapping<alwaysBigInt>}
|
|
1663
1663
|
*/
|
|
1664
|
-
readUInt64LE(): alwaysBigInt
|
|
1664
|
+
readUInt64LE(): ReturnBigValueMapping<alwaysBigInt>;
|
|
1665
1665
|
/**
|
|
1666
1666
|
* Write 64 bit integer.
|
|
1667
1667
|
*
|
|
@@ -1811,33 +1811,20 @@ declare class BiBase<DataType extends Buffer | Uint8Array, alwaysBigInt extends
|
|
|
1811
1811
|
/**
|
|
1812
1812
|
* Binary reader, includes bitfields and strings.
|
|
1813
1813
|
*
|
|
1814
|
-
* @param {
|
|
1814
|
+
* @param {DataType} input - File path or a `Buffer` or `Uint8Array`. Always found in .{@link data}
|
|
1815
1815
|
* @param {BiOptions?} options - Any options to set at start
|
|
1816
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start reader (default
|
|
1817
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset
|
|
1818
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness
|
|
1819
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if
|
|
1820
|
-
* @param {BiOptions["growthIncrement"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false
|
|
1821
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always
|
|
1822
|
-
* @param {BiOptions["
|
|
1816
|
+
* @param {BiOptions["byteOffset"]?} [options.byteOffset = 0] - Byte offset to start reader (default `0`)
|
|
1817
|
+
* @param {BiOptions["bitOffset"]?} [options.bitOffset = 0] - Bit offset (overrides {@link byteOffset}) (default `0`)
|
|
1818
|
+
* @param {BiOptions["endianness"]?} [options.endianness = "little"] - Endianness `big` or `little` (default `little`)
|
|
1819
|
+
* @param {BiOptions["strict"]?} [options.strict = true] - Strict mode: if `true` does not extend supplied array on outside read or write (default `true`)
|
|
1820
|
+
* @param {BiOptions["growthIncrement"]?} [options.growthIncrement = 1048576] - Amount of data to add when extending the buffer array when strict mode is false (default `1 MiB`)
|
|
1821
|
+
* @param {BiOptions["enforceBigInt"]?} [options.enforceBigInt = false] - 64 bit value reads will always return `bigint`. (default `false`)
|
|
1822
|
+
* @param {BiOptions["readOnly"]?} [options.readOnly = true] - Allow data writes when reading a file (default `true` in reader)
|
|
1823
1823
|
*
|
|
1824
1824
|
* @since 2.0
|
|
1825
1825
|
*/
|
|
1826
|
-
declare class BiReader<DataType
|
|
1827
|
-
|
|
1828
|
-
* Binary reader, includes bitfields and strings.
|
|
1829
|
-
*
|
|
1830
|
-
* @param {string|Buffer|Uint8Array} input - File path or a ``Buffer`` or ``Uint8Array``. Always found in ``BiReader.data``
|
|
1831
|
-
* @param {BiOptions?} options - Any options to set at start
|
|
1832
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start reader (default ``0``)
|
|
1833
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset 0-7 to start reader (default ``0``)
|
|
1834
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness ``big`` or ``little`` (default ``little``)
|
|
1835
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if ``true`` does not extend supplied array on outside write (default ``true`` in reader)
|
|
1836
|
-
* @param {BiOptions["growthIncrement"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false. Note: Changes logic in ``.get`` and ``.return``.
|
|
1837
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always be ``BigInt``.
|
|
1838
|
-
* @param {BiOptions["readOnly"]} options.readOnly - If you want to prevent write operations (default ``true`` in reader)
|
|
1839
|
-
*/
|
|
1840
|
-
constructor(input: string | DataType, options?: BiOptions);
|
|
1826
|
+
declare class BiReader<DataType, alwaysBigInt> extends BiBase<DataType, alwaysBigInt> {
|
|
1827
|
+
constructor(input: DataType, options?: BiOptions<alwaysBigInt>);
|
|
1841
1828
|
/**
|
|
1842
1829
|
* Bit field reader.
|
|
1843
1830
|
*
|
|
@@ -3768,109 +3755,109 @@ declare class BiReader<DataType extends Buffer | Uint8Array, alwaysBigInt extend
|
|
|
3768
3755
|
*
|
|
3769
3756
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3770
3757
|
*/
|
|
3771
|
-
get int64(): alwaysBigInt extends true ? bigint :
|
|
3758
|
+
get int64(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3772
3759
|
/**
|
|
3773
3760
|
* Read signed 64 bit integer.
|
|
3774
3761
|
*
|
|
3775
3762
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3776
3763
|
*/
|
|
3777
|
-
get bigint(): alwaysBigInt extends true ? bigint :
|
|
3764
|
+
get bigint(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3778
3765
|
/**
|
|
3779
3766
|
* Read signed 64 bit integer.
|
|
3780
3767
|
*
|
|
3781
3768
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3782
3769
|
*/
|
|
3783
|
-
get quad(): alwaysBigInt extends true ? bigint :
|
|
3770
|
+
get quad(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3784
3771
|
/**
|
|
3785
3772
|
* Read unsigned 64 bit integer.
|
|
3786
3773
|
*
|
|
3787
3774
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3788
3775
|
*/
|
|
3789
|
-
get uint64(): alwaysBigInt extends true ? bigint :
|
|
3776
|
+
get uint64(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3790
3777
|
/**
|
|
3791
3778
|
* Read unsigned 64 bit integer.
|
|
3792
3779
|
*
|
|
3793
3780
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3794
3781
|
*/
|
|
3795
|
-
get ubigint(): alwaysBigInt extends true ? bigint :
|
|
3782
|
+
get ubigint(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3796
3783
|
/**
|
|
3797
3784
|
* Read unsigned 64 bit integer.
|
|
3798
3785
|
*
|
|
3799
3786
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3800
3787
|
*/
|
|
3801
|
-
get uquad(): alwaysBigInt extends true ? bigint :
|
|
3788
|
+
get uquad(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3802
3789
|
/**
|
|
3803
3790
|
* Read signed 64 bit integer.
|
|
3804
3791
|
*
|
|
3805
3792
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3806
3793
|
*/
|
|
3807
|
-
get int64be(): alwaysBigInt extends true ? bigint :
|
|
3794
|
+
get int64be(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3808
3795
|
/**
|
|
3809
3796
|
* Read signed 64 bit integer.
|
|
3810
3797
|
*
|
|
3811
3798
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3812
3799
|
*/
|
|
3813
|
-
get bigintbe(): alwaysBigInt extends true ? bigint :
|
|
3800
|
+
get bigintbe(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3814
3801
|
/**
|
|
3815
3802
|
* Read signed 64 bit integer.
|
|
3816
3803
|
*
|
|
3817
3804
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3818
3805
|
*/
|
|
3819
|
-
get quadbe(): alwaysBigInt extends true ? bigint :
|
|
3806
|
+
get quadbe(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3820
3807
|
/**
|
|
3821
3808
|
* Read unsigned 64 bit integer.
|
|
3822
3809
|
*
|
|
3823
3810
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3824
3811
|
*/
|
|
3825
|
-
get uint64be(): alwaysBigInt extends true ? bigint :
|
|
3812
|
+
get uint64be(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3826
3813
|
/**
|
|
3827
3814
|
* Read unsigned 64 bit integer.
|
|
3828
3815
|
*
|
|
3829
3816
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3830
3817
|
*/
|
|
3831
|
-
get ubigintbe(): alwaysBigInt extends true ? bigint :
|
|
3818
|
+
get ubigintbe(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3832
3819
|
/**
|
|
3833
3820
|
* Read unsigned 64 bit integer.
|
|
3834
3821
|
*
|
|
3835
3822
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3836
3823
|
*/
|
|
3837
|
-
get uquadbe(): alwaysBigInt extends true ? bigint :
|
|
3824
|
+
get uquadbe(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3838
3825
|
/**
|
|
3839
3826
|
* Read signed 64 bit integer.
|
|
3840
3827
|
*
|
|
3841
3828
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3842
3829
|
*/
|
|
3843
|
-
get int64le(): alwaysBigInt extends true ? bigint :
|
|
3830
|
+
get int64le(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3844
3831
|
/**
|
|
3845
3832
|
* Read signed 64 bit integer.
|
|
3846
3833
|
*
|
|
3847
3834
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3848
3835
|
*/
|
|
3849
|
-
get bigintle(): alwaysBigInt extends true ? bigint :
|
|
3836
|
+
get bigintle(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3850
3837
|
/**
|
|
3851
3838
|
* Read signed 64 bit integer.
|
|
3852
3839
|
*
|
|
3853
3840
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3854
3841
|
*/
|
|
3855
|
-
get quadle(): alwaysBigInt extends true ? bigint :
|
|
3842
|
+
get quadle(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3856
3843
|
/**
|
|
3857
3844
|
* Read unsigned 64 bit integer.
|
|
3858
3845
|
*
|
|
3859
3846
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3860
3847
|
*/
|
|
3861
|
-
get uint64le(): alwaysBigInt extends true ? bigint :
|
|
3848
|
+
get uint64le(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3862
3849
|
/**
|
|
3863
3850
|
* Read unsigned 64 bit integer.
|
|
3864
3851
|
*
|
|
3865
3852
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3866
3853
|
*/
|
|
3867
|
-
get ubigintle(): alwaysBigInt extends true ? bigint :
|
|
3854
|
+
get ubigintle(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3868
3855
|
/**
|
|
3869
3856
|
* Read unsigned 64 bit integer.
|
|
3870
3857
|
*
|
|
3871
3858
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
3872
3859
|
*/
|
|
3873
|
-
get uquadle(): alwaysBigInt extends true ? bigint :
|
|
3860
|
+
get uquadle(): alwaysBigInt extends true ? bigint : BigValue;
|
|
3874
3861
|
/**
|
|
3875
3862
|
* Read double float.
|
|
3876
3863
|
*
|
|
@@ -4322,31 +4309,19 @@ declare class BiReader<DataType extends Buffer | Uint8Array, alwaysBigInt extend
|
|
|
4322
4309
|
/**
|
|
4323
4310
|
* Binary writer, includes bitfields and strings.
|
|
4324
4311
|
*
|
|
4325
|
-
* @param {
|
|
4312
|
+
* @param {DataType} input - File path or a `Buffer` or `Uint8Array`. Always found in .{@link data}
|
|
4326
4313
|
* @param {BiOptions?} options - Any options to set at start
|
|
4327
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start
|
|
4328
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset
|
|
4329
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness
|
|
4330
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if
|
|
4331
|
-
* @param {BiOptions["growthIncrement"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false
|
|
4332
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always
|
|
4314
|
+
* @param {BiOptions["byteOffset"]?} [options.byteOffset = 0] - Byte offset to start reader (default `0`)
|
|
4315
|
+
* @param {BiOptions["bitOffset"]?} [options.bitOffset = 0] - Bit offset (overrides {@link byteOffset}) (default `0`)
|
|
4316
|
+
* @param {BiOptions["endianness"]?} [options.endianness = "little"] - Endianness `big` or `little` (default `little`)
|
|
4317
|
+
* @param {BiOptions["strict"]?} [options.strict = true] - Strict mode: if `true` does not extend supplied array on outside read or write (default `true`)
|
|
4318
|
+
* @param {BiOptions["growthIncrement"]?} [options.growthIncrement = 1048576] - Amount of data to add when extending the buffer array when strict mode is false (default `1 MiB`)
|
|
4319
|
+
* @param {BiOptions["enforceBigInt"]?} [options.enforceBigInt = false] - 64 bit value reads will always return `bigint`. (default `false`)
|
|
4333
4320
|
*
|
|
4334
4321
|
* @since 2.0
|
|
4335
4322
|
*/
|
|
4336
|
-
declare class BiWriter<DataType
|
|
4337
|
-
|
|
4338
|
-
* Binary writer, includes bitfields and strings.
|
|
4339
|
-
*
|
|
4340
|
-
* @param {string|Buffer|Uint8Array} input - ``Buffer`` or ``Uint8Array``. Always found in ``BiWriter.data``
|
|
4341
|
-
* @param {BiOptions?} options - Any options to set at start
|
|
4342
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start writer (default ``0``)
|
|
4343
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset 0-7 to start writer (default ``0``)
|
|
4344
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness ``big`` or ``little`` (default ``little``)
|
|
4345
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if ``true`` does not extend supplied array on outside write (default ``false`` in writer)
|
|
4346
|
-
* @param {BiOptions["windowSize"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false. Note: Changes logic in ``.get`` and ``.return``.
|
|
4347
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always be ``BigInt``.
|
|
4348
|
-
*/
|
|
4349
|
-
constructor(input?: string | DataType, options?: BiOptions);
|
|
4323
|
+
declare class BiWriter<DataType, alwaysBigInt> extends BiBase<DataType, alwaysBigInt> {
|
|
4324
|
+
constructor(input?: DataType, options?: BiOptions<alwaysBigInt>);
|
|
4350
4325
|
/**
|
|
4351
4326
|
* Bit field writer.
|
|
4352
4327
|
*
|
|
@@ -6775,10 +6750,14 @@ declare class BiWriter<DataType extends Buffer | Uint8Array, alwaysBigInt extend
|
|
|
6775
6750
|
dwpstring4be(string: string): void;
|
|
6776
6751
|
}
|
|
6777
6752
|
|
|
6753
|
+
/**
|
|
6754
|
+
* @file BiReaderAsync / Writer base for working in sync Buffers or full file reads. Node and Browser.
|
|
6755
|
+
*/
|
|
6756
|
+
|
|
6778
6757
|
/**
|
|
6779
6758
|
* Base class for BiReader and BiWriter
|
|
6780
6759
|
*/
|
|
6781
|
-
declare class BiBaseAsync<DataType
|
|
6760
|
+
declare class BiBaseAsync<DataType, alwaysBigInt> {
|
|
6782
6761
|
#private;
|
|
6783
6762
|
/**
|
|
6784
6763
|
* Endianness of default read.
|
|
@@ -6814,7 +6793,7 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
6814
6793
|
/**
|
|
6815
6794
|
* Open file handle
|
|
6816
6795
|
*/
|
|
6817
|
-
fd:
|
|
6796
|
+
fd: any;
|
|
6818
6797
|
/**
|
|
6819
6798
|
* Current file path
|
|
6820
6799
|
*/
|
|
@@ -6844,12 +6823,20 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
6844
6823
|
*
|
|
6845
6824
|
* Use async {@link getData} while in file mode!
|
|
6846
6825
|
*/
|
|
6847
|
-
get data(): DataType
|
|
6826
|
+
get data(): ReturnMapping<DataType>;
|
|
6848
6827
|
/**
|
|
6849
6828
|
* Get the current buffer data.
|
|
6829
|
+
*
|
|
6830
|
+
* For use in file mode!
|
|
6831
|
+
*/
|
|
6832
|
+
getData(): Promise<ReturnMapping<DataType> | Buffer<ArrayBuffer>>;
|
|
6833
|
+
/**
|
|
6834
|
+
* Set the current buffer data.
|
|
6835
|
+
*/
|
|
6836
|
+
set data(data: DataType);
|
|
6837
|
+
/**
|
|
6838
|
+
* If the buffer was extended and needs to be trimmed
|
|
6850
6839
|
*/
|
|
6851
|
-
getData(): Promise<Buffer<ArrayBuffer> | DataType>;
|
|
6852
|
-
set setData(data: DataType);
|
|
6853
6840
|
wasExpanded: boolean;
|
|
6854
6841
|
/**
|
|
6855
6842
|
* Get the DataView of current buffer data.
|
|
@@ -6858,11 +6845,11 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
6858
6845
|
/**
|
|
6859
6846
|
* array of loaded data chunks
|
|
6860
6847
|
*/
|
|
6861
|
-
chunks: DataType[];
|
|
6848
|
+
chunks: ReturnMapping<DataType>[];
|
|
6862
6849
|
/**
|
|
6863
6850
|
* Promises for data chunks
|
|
6864
6851
|
*/
|
|
6865
|
-
chunkPromises: Promise<DataType
|
|
6852
|
+
chunkPromises: Promise<ReturnMapping<DataType>>[];
|
|
6866
6853
|
/**
|
|
6867
6854
|
* Edited data chunks
|
|
6868
6855
|
*/
|
|
@@ -6881,7 +6868,7 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
6881
6868
|
* Array of all chunks to quickly load all parts
|
|
6882
6869
|
*/
|
|
6883
6870
|
loadAllPromise: Promise<void>;
|
|
6884
|
-
constructor(input:
|
|
6871
|
+
constructor(input: DataType, options?: BiOptions<alwaysBigInt>);
|
|
6885
6872
|
/**
|
|
6886
6873
|
* Settings for when using .str
|
|
6887
6874
|
*
|
|
@@ -6915,7 +6902,7 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
6915
6902
|
/**
|
|
6916
6903
|
* commit data and removes it.
|
|
6917
6904
|
*/
|
|
6918
|
-
close(): Promise<DataType
|
|
6905
|
+
close(): Promise<ReturnMapping<DataType>>;
|
|
6919
6906
|
/**
|
|
6920
6907
|
* Write data buffer back to file
|
|
6921
6908
|
*/
|
|
@@ -7216,7 +7203,7 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
7216
7203
|
*
|
|
7217
7204
|
* Note: Will remove all data after current position if ``growthIncrement`` was set.
|
|
7218
7205
|
*/
|
|
7219
|
-
get(): Promise<
|
|
7206
|
+
get(): Promise<ReturnMapping<DataType> | Buffer<ArrayBuffer>>;
|
|
7220
7207
|
/**
|
|
7221
7208
|
* Returns current data.
|
|
7222
7209
|
*
|
|
@@ -7224,13 +7211,13 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
7224
7211
|
*
|
|
7225
7212
|
* Use ``.data`` instead if you want the full buffer data.
|
|
7226
7213
|
*/
|
|
7227
|
-
getFullBuffer(): Promise<
|
|
7214
|
+
getFullBuffer(): Promise<ReturnMapping<DataType> | Buffer<ArrayBuffer>>;
|
|
7228
7215
|
/**
|
|
7229
7216
|
* Returns current data.
|
|
7230
7217
|
*
|
|
7231
7218
|
* Note: Will remove all data after current position if ``growthIncrement`` was set.
|
|
7232
7219
|
*/
|
|
7233
|
-
return(): Promise<
|
|
7220
|
+
return(): Promise<ReturnMapping<DataType> | Buffer<ArrayBuffer>>;
|
|
7234
7221
|
/**
|
|
7235
7222
|
* Removes data.
|
|
7236
7223
|
*
|
|
@@ -7526,7 +7513,7 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
7526
7513
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
7527
7514
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
7528
7515
|
*/
|
|
7529
|
-
replace(data: DataType, offset?: number, consume?: boolean): Promise<
|
|
7516
|
+
replace(data: DataType, offset?: number, consume?: boolean): Promise<ReturnMapping<DataType>>;
|
|
7530
7517
|
/**
|
|
7531
7518
|
* Replaces data in data.
|
|
7532
7519
|
*
|
|
@@ -7536,7 +7523,7 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
7536
7523
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
7537
7524
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
7538
7525
|
*/
|
|
7539
|
-
overwrite(data: DataType, consume?: boolean, offset?: number): Promise<
|
|
7526
|
+
overwrite(data: DataType, consume?: boolean, offset?: number): Promise<ReturnMapping<DataType>>;
|
|
7540
7527
|
/**
|
|
7541
7528
|
* Returns part of data from current byte position to end of data unless supplied.
|
|
7542
7529
|
*
|
|
@@ -8202,37 +8189,37 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
8202
8189
|
* @param {endian?} endian - ``big`` or ``little``
|
|
8203
8190
|
* @param {boolean} consume - move offset after read
|
|
8204
8191
|
*/
|
|
8205
|
-
readInt64(unsigned?: boolean, endian?: endian, consume?: boolean): Promise<alwaysBigInt
|
|
8192
|
+
readInt64(unsigned?: boolean, endian?: endian, consume?: boolean): Promise<ReturnBigValueMapping<alwaysBigInt>>;
|
|
8206
8193
|
/**
|
|
8207
8194
|
* Read unsigned 64 bit integer.
|
|
8208
8195
|
*
|
|
8209
8196
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
8210
8197
|
*/
|
|
8211
|
-
readUInt64(): Promise<alwaysBigInt
|
|
8198
|
+
readUInt64(): Promise<ReturnBigValueMapping<alwaysBigInt>>;
|
|
8212
8199
|
/**
|
|
8213
8200
|
* Read signed 64 bit integer.
|
|
8214
8201
|
*
|
|
8215
8202
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
8216
8203
|
*/
|
|
8217
|
-
readInt64BE(): Promise<alwaysBigInt
|
|
8204
|
+
readInt64BE(): Promise<ReturnBigValueMapping<alwaysBigInt>>;
|
|
8218
8205
|
/**
|
|
8219
8206
|
* Read signed 64 bit integer.
|
|
8220
8207
|
*
|
|
8221
8208
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
8222
8209
|
*/
|
|
8223
|
-
readInt64LE(): Promise<alwaysBigInt
|
|
8210
|
+
readInt64LE(): Promise<ReturnBigValueMapping<alwaysBigInt>>;
|
|
8224
8211
|
/**
|
|
8225
8212
|
* Read unsigned 64 bit integer.
|
|
8226
8213
|
*
|
|
8227
8214
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
8228
8215
|
*/
|
|
8229
|
-
readUInt64BE(): Promise<alwaysBigInt
|
|
8216
|
+
readUInt64BE(): Promise<ReturnBigValueMapping<alwaysBigInt>>;
|
|
8230
8217
|
/**
|
|
8231
8218
|
* Read unsigned 64 bit integer.
|
|
8232
8219
|
*
|
|
8233
8220
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
8234
8221
|
*/
|
|
8235
|
-
readUInt64LE(): Promise<alwaysBigInt
|
|
8222
|
+
readUInt64LE(): Promise<ReturnBigValueMapping<alwaysBigInt>>;
|
|
8236
8223
|
/**
|
|
8237
8224
|
* Write 64 bit integer.
|
|
8238
8225
|
*
|
|
@@ -8371,51 +8358,38 @@ declare class BiBaseAsync<DataType extends Buffer | Uint8Array, alwaysBigInt ext
|
|
|
8371
8358
|
/**
|
|
8372
8359
|
* Async Binary reader, includes bitfields and strings.
|
|
8373
8360
|
*
|
|
8374
|
-
* @param {
|
|
8361
|
+
* @param {DataType} input - File path or a `Buffer` or `Uint8Array`.
|
|
8375
8362
|
* @param {BiOptions?} options - Any options to set at start
|
|
8376
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start
|
|
8377
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset
|
|
8378
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness
|
|
8379
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if
|
|
8380
|
-
* @param {BiOptions["growthIncrement"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false
|
|
8381
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always
|
|
8382
|
-
* @param {BiOptions["readOnly"]} options.readOnly -
|
|
8363
|
+
* @param {BiOptions["byteOffset"]?} [options.byteOffset = 0] - Byte offset to start reader (default `0`)
|
|
8364
|
+
* @param {BiOptions["bitOffset"]?} [options.bitOffset = 0] - Bit offset (overrides {@link byteOffset}) (default `0`)
|
|
8365
|
+
* @param {BiOptions["endianness"]?} [options.endianness = "little"] - Endianness `big` or `little` (default `little`)
|
|
8366
|
+
* @param {BiOptions["strict"]?} [options.strict = true] - Strict mode: if `true` does not extend supplied array on outside read or write (default `true`)
|
|
8367
|
+
* @param {BiOptions["growthIncrement"]?} [options.growthIncrement = 1048576] - Amount of data to add when extending the buffer array when strict mode is false (default `1 MiB`)
|
|
8368
|
+
* @param {BiOptions["enforceBigInt"]?} [options.enforceBigInt = false] - 64 bit value reads will always return `bigint`. (default `false`)
|
|
8369
|
+
* @param {BiOptions["readOnly"]?} [options.readOnly = true] - Allow data writes when reading a file (default `true` in reader)
|
|
8370
|
+
* @param {BiOptions["windowSize"]?} [options.windowSize = 4096] - Size of the chunk of a file to load per read. Set to `0` to load the whole file in one async read (default `4 KiB`)
|
|
8383
8371
|
*
|
|
8384
8372
|
* @since 4.0
|
|
8385
8373
|
*/
|
|
8386
|
-
declare class BiReaderAsync<DataType
|
|
8374
|
+
declare class BiReaderAsync<DataType, alwaysBigInt> extends BiBaseAsync<DataType, alwaysBigInt> {
|
|
8375
|
+
constructor(input: DataType, options?: BiOptions<alwaysBigInt>);
|
|
8387
8376
|
/**
|
|
8388
|
-
*
|
|
8377
|
+
* Creates and opens a new `BiReaderAsync`.
|
|
8389
8378
|
*
|
|
8390
|
-
* @param {
|
|
8379
|
+
* @param {DataType} input - File path or a `Buffer` or `Uint8Array`.
|
|
8391
8380
|
* @param {BiOptions?} options - Any options to set at start
|
|
8392
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start
|
|
8393
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset
|
|
8394
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness
|
|
8395
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if
|
|
8396
|
-
* @param {BiOptions["growthIncrement"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false
|
|
8397
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always
|
|
8398
|
-
* @param {BiOptions["readOnly"]} options.readOnly -
|
|
8399
|
-
|
|
8400
|
-
constructor(input: string | DataType, options?: BiOptions);
|
|
8401
|
-
/**
|
|
8402
|
-
* Creates and opens a new `BiReaderAsync`
|
|
8403
|
-
*
|
|
8404
|
-
* Includes bitfields and strings.
|
|
8381
|
+
* @param {BiOptions["byteOffset"]?} [options.byteOffset = 0] - Byte offset to start reader (default `0`)
|
|
8382
|
+
* @param {BiOptions["bitOffset"]?} [options.bitOffset = 0] - Bit offset (overrides {@link byteOffset}) (default `0`)
|
|
8383
|
+
* @param {BiOptions["endianness"]?} [options.endianness = "little"] - Endianness `big` or `little` (default `little`)
|
|
8384
|
+
* @param {BiOptions["strict"]?} [options.strict = true] - Strict mode: if `true` does not extend supplied array on outside read or write (default `true`)
|
|
8385
|
+
* @param {BiOptions["growthIncrement"]?} [options.growthIncrement = 1048576] - Amount of data to add when extending the buffer array when strict mode is false (default `1 MiB`)
|
|
8386
|
+
* @param {BiOptions["enforceBigInt"]?} [options.enforceBigInt = false] - 64 bit value reads will always return `bigint`. (default `false`)
|
|
8387
|
+
* @param {BiOptions["readOnly"]?} [options.readOnly = true] - Allow data writes when reading a file (default `true` in reader)
|
|
8388
|
+
* @param {BiOptions["windowSize"]?} [options.windowSize = 4096] - Size of the chunk of a file to load per read. Set to `0` to load the whole file in one async read (default `4 KiB`)
|
|
8405
8389
|
*
|
|
8406
|
-
* @
|
|
8407
|
-
* @param {BiOptions?} options - Any options to set at start
|
|
8408
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start writer (default ``0``)
|
|
8409
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset 0-7 to start writer (default ``0``)
|
|
8410
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness ``big`` or ``little`` (default ``little``)
|
|
8411
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if ``true`` does not extend supplied array on outside write (default ``false``)
|
|
8412
|
-
* @param {BiOptions["growthIncrement"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false. Note: Changes logic in ``.get`` and ``.return``.
|
|
8413
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always stay ``BigInt``.
|
|
8414
|
-
* @param {BiOptions["readonly"]} options.readonly - If you want to prevent write operations (default true in reader)
|
|
8415
|
-
*
|
|
8416
|
-
* @returns {Promise<BiReaderAsync<DataType, hasBigInt>>}
|
|
8390
|
+
* @since 4.0
|
|
8417
8391
|
*/
|
|
8418
|
-
static create<DataType
|
|
8392
|
+
static create<DataType, alwaysBigInt>(input: DataType, options?: BiOptions<alwaysBigInt>): Promise<BiReaderAsync<DataType, alwaysBigInt>>;
|
|
8419
8393
|
/**
|
|
8420
8394
|
* Bit field reader.
|
|
8421
8395
|
*
|
|
@@ -10346,109 +10320,109 @@ declare class BiReaderAsync<DataType extends Buffer | Uint8Array, hasBigInt exte
|
|
|
10346
10320
|
*
|
|
10347
10321
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10348
10322
|
*/
|
|
10349
|
-
int64(): Promise<
|
|
10323
|
+
int64(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10350
10324
|
/**
|
|
10351
10325
|
* Read signed 64 bit integer.
|
|
10352
10326
|
*
|
|
10353
10327
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10354
10328
|
*/
|
|
10355
|
-
bigint(): Promise<
|
|
10329
|
+
bigint(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10356
10330
|
/**
|
|
10357
10331
|
* Read signed 64 bit integer.
|
|
10358
10332
|
*
|
|
10359
10333
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10360
10334
|
*/
|
|
10361
|
-
quad(): Promise<
|
|
10335
|
+
quad(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10362
10336
|
/**
|
|
10363
10337
|
* Read unsigned 64 bit integer.
|
|
10364
10338
|
*
|
|
10365
10339
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10366
10340
|
*/
|
|
10367
|
-
uint64(): Promise<
|
|
10341
|
+
uint64(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10368
10342
|
/**
|
|
10369
10343
|
* Read unsigned 64 bit integer.
|
|
10370
10344
|
*
|
|
10371
10345
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10372
10346
|
*/
|
|
10373
|
-
ubigint(): Promise<
|
|
10347
|
+
ubigint(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10374
10348
|
/**
|
|
10375
10349
|
* Read unsigned 64 bit integer.
|
|
10376
10350
|
*
|
|
10377
10351
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10378
10352
|
*/
|
|
10379
|
-
uquad(): Promise<
|
|
10353
|
+
uquad(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10380
10354
|
/**
|
|
10381
10355
|
* Read signed 64 bit integer.
|
|
10382
10356
|
*
|
|
10383
10357
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10384
10358
|
*/
|
|
10385
|
-
int64be(): Promise<
|
|
10359
|
+
int64be(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10386
10360
|
/**
|
|
10387
10361
|
* Read signed 64 bit integer.
|
|
10388
10362
|
*
|
|
10389
10363
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10390
10364
|
*/
|
|
10391
|
-
bigintbe(): Promise<
|
|
10365
|
+
bigintbe(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10392
10366
|
/**
|
|
10393
10367
|
* Read signed 64 bit integer.
|
|
10394
10368
|
*
|
|
10395
10369
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10396
10370
|
*/
|
|
10397
|
-
quadbe(): Promise<
|
|
10371
|
+
quadbe(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10398
10372
|
/**
|
|
10399
10373
|
* Read unsigned 64 bit integer.
|
|
10400
10374
|
*
|
|
10401
10375
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10402
10376
|
*/
|
|
10403
|
-
uint64be(): Promise<
|
|
10377
|
+
uint64be(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10404
10378
|
/**
|
|
10405
10379
|
* Read unsigned 64 bit integer.
|
|
10406
10380
|
*
|
|
10407
10381
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10408
10382
|
*/
|
|
10409
|
-
ubigintbe(): Promise<
|
|
10383
|
+
ubigintbe(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10410
10384
|
/**
|
|
10411
10385
|
* Read unsigned 64 bit integer.
|
|
10412
10386
|
*
|
|
10413
10387
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10414
10388
|
*/
|
|
10415
|
-
uquadbe(): Promise<
|
|
10389
|
+
uquadbe(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10416
10390
|
/**
|
|
10417
10391
|
* Read signed 64 bit integer.
|
|
10418
10392
|
*
|
|
10419
10393
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10420
10394
|
*/
|
|
10421
|
-
int64le(): Promise<
|
|
10395
|
+
int64le(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10422
10396
|
/**
|
|
10423
10397
|
* Read signed 64 bit integer.
|
|
10424
10398
|
*
|
|
10425
10399
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10426
10400
|
*/
|
|
10427
|
-
bigintle(): Promise<
|
|
10401
|
+
bigintle(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10428
10402
|
/**
|
|
10429
10403
|
* Read signed 64 bit integer.
|
|
10430
10404
|
*
|
|
10431
10405
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10432
10406
|
*/
|
|
10433
|
-
quadle(): Promise<
|
|
10407
|
+
quadle(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10434
10408
|
/**
|
|
10435
10409
|
* Read unsigned 64 bit integer.
|
|
10436
10410
|
*
|
|
10437
10411
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10438
10412
|
*/
|
|
10439
|
-
uint64le(): Promise<
|
|
10413
|
+
uint64le(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10440
10414
|
/**
|
|
10441
10415
|
* Read unsigned 64 bit integer.
|
|
10442
10416
|
*
|
|
10443
10417
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10444
10418
|
*/
|
|
10445
|
-
ubigintle(): Promise<
|
|
10419
|
+
ubigintle(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10446
10420
|
/**
|
|
10447
10421
|
* Read unsigned 64 bit integer.
|
|
10448
10422
|
*
|
|
10449
10423
|
* Note: If ``enforceBigInt`` was set to ``true``, this always returns a ``BigInt`` otherwise it will return a ``number`` if integer safe.
|
|
10450
10424
|
*/
|
|
10451
|
-
uquadle(): Promise<
|
|
10425
|
+
uquadle(): Promise<alwaysBigInt extends true ? bigint : BigValue>;
|
|
10452
10426
|
/**
|
|
10453
10427
|
* Read double float.
|
|
10454
10428
|
*
|
|
@@ -10900,50 +10874,37 @@ declare class BiReaderAsync<DataType extends Buffer | Uint8Array, hasBigInt exte
|
|
|
10900
10874
|
/**
|
|
10901
10875
|
* Async Binary writer, includes bitfields and strings.
|
|
10902
10876
|
*
|
|
10903
|
-
* @param {
|
|
10877
|
+
* @param {DataType} input - File path or a `Buffer` or ``Uint8Array`.
|
|
10904
10878
|
* @param {BiOptions?} options - Any options to set at start
|
|
10905
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start
|
|
10906
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset
|
|
10907
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness
|
|
10908
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if
|
|
10909
|
-
* @param {BiOptions["growthIncrement"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false
|
|
10910
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always
|
|
10879
|
+
* @param {BiOptions["byteOffset"]?} [options.byteOffset = 0] - Byte offset to start reader (default `0`)
|
|
10880
|
+
* @param {BiOptions["bitOffset"]?} [options.bitOffset = 0] - Bit offset (overrides {@link byteOffset}) (default `0`)
|
|
10881
|
+
* @param {BiOptions["endianness"]?} [options.endianness = "little"] - Endianness `big` or `little` (default `little`)
|
|
10882
|
+
* @param {BiOptions["strict"]?} [options.strict = true] - Strict mode: if `true` does not extend supplied array on outside read or write (default `true`)
|
|
10883
|
+
* @param {BiOptions["growthIncrement"]?} [options.growthIncrement = 1048576] - Amount of data to add when extending the buffer array when strict mode is false (default `1 MiB`)
|
|
10884
|
+
* @param {BiOptions["enforceBigInt"]?} [options.enforceBigInt = false] - 64 bit value reads will always return `bigint`. (default `false`)
|
|
10885
|
+
* @param {BiOptions["windowSize"]?} [options.windowSize = 4096] - Size of the chunk of a file to load per read. Set to `0` to load the whole file in one async read (default `4 KiB`)
|
|
10911
10886
|
*
|
|
10912
10887
|
* @since 4.0
|
|
10913
10888
|
*/
|
|
10914
|
-
declare class BiWriterAsync<DataType
|
|
10889
|
+
declare class BiWriterAsync<DataType, alwaysBigInt> extends BiBaseAsync<DataType, alwaysBigInt> {
|
|
10890
|
+
constructor(input?: DataType, options?: BiOptions<alwaysBigInt>);
|
|
10915
10891
|
/**
|
|
10916
|
-
* Async Binary writer, includes bitfields and strings.
|
|
10917
10892
|
*
|
|
10918
|
-
*
|
|
10919
|
-
* @param {BiOptions?} options - Any options to set at start
|
|
10920
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start writer (default ``0``)
|
|
10921
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset 0-7 to start writer (default ``0``)
|
|
10922
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness ``big`` or ``little`` (default ``little``)
|
|
10923
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if ``true`` does not extend supplied array on outside write (default ``false``)
|
|
10924
|
-
* @param {BiOptions["growthIncrement"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false.
|
|
10925
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always stay ``BigInt``.
|
|
10926
|
-
*/
|
|
10927
|
-
constructor(input?: string | DataType, options?: BiOptions);
|
|
10928
|
-
/**
|
|
10893
|
+
* Creates and opens a new `BiWriterAsync`.
|
|
10929
10894
|
*
|
|
10930
|
-
*
|
|
10931
|
-
*
|
|
10932
|
-
* includes bitfields and strings.
|
|
10933
|
-
*
|
|
10934
|
-
* @param {string|Buffer|Uint8Array} input - ``Buffer`` or ``Uint8Array``. Always found in ``BiWriter.data``
|
|
10895
|
+
* @param {DataType} input - File path or a `Buffer` or ``Uint8Array`.
|
|
10935
10896
|
* @param {BiOptions?} options - Any options to set at start
|
|
10936
|
-
* @param {BiOptions["byteOffset"]?} options.byteOffset - Byte offset to start
|
|
10937
|
-
* @param {BiOptions["bitOffset"]?} options.bitOffset - Bit offset
|
|
10938
|
-
* @param {BiOptions["endianness"]?} options.endianness - Endianness
|
|
10939
|
-
* @param {BiOptions["strict"]?} options.strict - Strict mode: if
|
|
10940
|
-
* @param {BiOptions["growthIncrement"]?} options.growthIncrement - Amount of data to add when extending the buffer array when strict mode is false
|
|
10941
|
-
* @param {BiOptions["enforceBigInt"]?} options.enforceBigInt - 64 bit value reads will always
|
|
10942
|
-
* @param {BiOptions["
|
|
10897
|
+
* @param {BiOptions["byteOffset"]?} [options.byteOffset = 0] - Byte offset to start reader (default `0`)
|
|
10898
|
+
* @param {BiOptions["bitOffset"]?} [options.bitOffset = 0] - Bit offset (overrides {@link byteOffset}) (default `0`)
|
|
10899
|
+
* @param {BiOptions["endianness"]?} [options.endianness = "little"] - Endianness `big` or `little` (default `little`)
|
|
10900
|
+
* @param {BiOptions["strict"]?} [options.strict = true] - Strict mode: if `true` does not extend supplied array on outside read or write (default `true`)
|
|
10901
|
+
* @param {BiOptions["growthIncrement"]?} [options.growthIncrement = 1048576] - Amount of data to add when extending the buffer array when strict mode is false (default `1 MiB`)
|
|
10902
|
+
* @param {BiOptions["enforceBigInt"]?} [options.enforceBigInt = false] - 64 bit value reads will always return `bigint`. (default `false`)
|
|
10903
|
+
* @param {BiOptions["windowSize"]?} [options.windowSize = 4096] - Size of the chunk of a file to load per read. Set to `0` to load the whole file in one async read (default `4 KiB`)
|
|
10943
10904
|
*
|
|
10944
|
-
* @returns {Promise<BiWriterAsync<DataType,
|
|
10905
|
+
* @returns {Promise<BiWriterAsync<DataType, alwaysBigInt>>}
|
|
10945
10906
|
*/
|
|
10946
|
-
static create<DataType
|
|
10907
|
+
static create<DataType, alwaysBigInt>(input: DataType, options?: BiOptions<alwaysBigInt>): Promise<BiWriterAsync<DataType, alwaysBigInt>>;
|
|
10947
10908
|
/**
|
|
10948
10909
|
* Bit field writer.
|
|
10949
10910
|
*
|
|
@@ -13383,7 +13344,7 @@ declare class bireader {
|
|
|
13383
13344
|
/**
|
|
13384
13345
|
* Not in use anymore.
|
|
13385
13346
|
* @since 4.0
|
|
13386
|
-
* @deprecated Use ``
|
|
13347
|
+
* @deprecated Use ``BiReaderLegacy`` instead.
|
|
13387
13348
|
*/
|
|
13388
13349
|
declare class BiReaderStream {
|
|
13389
13350
|
constructor();
|
|
@@ -13399,10 +13360,10 @@ declare class biwriter {
|
|
|
13399
13360
|
/**
|
|
13400
13361
|
* Not in use anymore.
|
|
13401
13362
|
* @since 4.0
|
|
13402
|
-
* @deprecated Use ``
|
|
13363
|
+
* @deprecated Use ``BiWriterLegacy`` instead.
|
|
13403
13364
|
*/
|
|
13404
13365
|
declare class BiWriterStream {
|
|
13405
13366
|
constructor();
|
|
13406
13367
|
}
|
|
13407
13368
|
|
|
13408
|
-
export {
|
|
13369
|
+
export { BiReader, BiReaderAsync, BiReaderStream, BiWriter, BiWriterAsync, BiWriterStream, bireader, biwriter, hexdump };
|