@gsknnft/bigint-buffer 1.3.2 → 1.4.2
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 +123 -126
- package/build/Release/bigint_buffer.exp +0 -0
- package/build/Release/bigint_buffer.iobj +0 -0
- package/build/Release/bigint_buffer.ipdb +0 -0
- package/build/Release/bigint_buffer.lib +0 -0
- package/build/Release/bigint_buffer.node +0 -0
- package/build/Release/bigint_buffer.pdb +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.node.recipe +11 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/CL.command.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/CL.read.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/CL.write.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/Cl.items.tlog +2 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/bigint_buffer.lastbuildstate +2 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/link.command.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/link.read.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/link.secondary.1.tlog +5 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/link.write.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/src/bigint-buffer.obj +0 -0
- package/build/Release/obj/bigint_buffer/win_delay_load_hook.obj +0 -0
- package/build/bigint_buffer.vcxproj +148 -0
- package/build/bigint_buffer.vcxproj.filters +67 -0
- package/build/binding.sln +19 -0
- package/build/config.gypi +522 -0
- package/dist/index.cjs +1 -205
- package/dist/index.js +347 -202
- package/dist/index.umd.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/bigint-buffer.test.d.ts +1 -0
- package/dist/types/conversion/index.d.ts +1 -0
- package/dist/types/conversion/src/ts/index.d.ts +168 -0
- package/dist/types/conversion/test/bigintToBase64.test.d.ts +1 -0
- package/dist/types/conversion/test/bigintToBuf.test.d.ts +1 -0
- package/dist/types/conversion/test/bigintToHex.test.d.ts +1 -0
- package/dist/types/conversion/test/bigintToText.test.d.ts +1 -0
- package/dist/types/conversion/test/bufToBigint.test.d.ts +1 -0
- package/dist/types/conversion/test/hexToBigint.test.d.ts +1 -0
- package/dist/types/conversion/test/hexToBuf.test.d.ts +1 -0
- package/dist/types/conversion/test/parseHex.test.d.ts +1 -0
- package/dist/types/conversion/test/setup.test.d.ts +1 -0
- package/dist/types/conversion/test/textToBuf.test.d.ts +1 -0
- package/dist/types/conversion/vite.config.d.ts +2 -0
- package/dist/types/conversion/vitest.config.d.ts +2 -0
- package/dist/types/dist/dist/conversion/conversion/index.d.ts +1 -0
- package/dist/{index.d.ts → types/dist/dist/index.d.ts} +2 -0
- package/dist/types/index.bench.d.ts +1 -0
- package/dist/types/index.d.ts +80 -0
- package/dist/types/index.spec.d.ts +1 -0
- package/package.json +83 -49
- package/src/bigint-buffer.test.ts +11 -0
- package/src/conversion/.github/workflows/build-and-test.yml +116 -0
- package/src/conversion/CODE_OF_CONDUCT.md +134 -0
- package/src/conversion/LICENSE +21 -0
- package/src/conversion/README.md +48 -0
- package/src/conversion/docs/README.md +34 -0
- package/src/conversion/docs/functions/base64ToBigint.md +27 -0
- package/src/conversion/docs/functions/bigintToBase64.md +43 -0
- package/src/conversion/docs/functions/bigintToBuf.md +35 -0
- package/src/conversion/docs/functions/bigintToHex.md +43 -0
- package/src/conversion/docs/functions/bigintToText.md +31 -0
- package/src/conversion/docs/functions/bufToBigint.md +25 -0
- package/src/conversion/docs/functions/bufToHex.md +37 -0
- package/src/conversion/docs/functions/bufToText.md +27 -0
- package/src/conversion/docs/functions/hexToBigint.md +29 -0
- package/src/conversion/docs/functions/hexToBuf.md +37 -0
- package/src/conversion/docs/functions/parseHex.md +45 -0
- package/src/conversion/docs/functions/textToBigint.md +27 -0
- package/src/conversion/docs/functions/textToBuf.md +33 -0
- package/src/conversion/docs/functions/toBigIntBE.md +27 -0
- package/src/conversion/docs/functions/toBigIntLE.md +27 -0
- package/src/conversion/docs/functions/toBufferBE.md +33 -0
- package/src/conversion/docs/functions/toBufferLE.md +33 -0
- package/src/conversion/docs/functions/validateBigIntBuffer.md +15 -0
- package/src/conversion/docs/type-aliases/TypedArray.md +11 -0
- package/src/conversion/docs/variables/isNative.md +11 -0
- package/src/conversion/example.cjs +9 -0
- package/src/conversion/example.esm.js +11 -0
- package/src/conversion/index.ts +1 -0
- package/src/conversion/package.json +163 -0
- package/src/conversion/src/docs/index.md +47 -0
- package/src/conversion/src/ts/index.ts +514 -0
- package/src/conversion/test/bigintToBase64.test.ts +37 -0
- package/src/conversion/test/bigintToBuf.test.ts +43 -0
- package/src/conversion/test/bigintToHex.test.ts +52 -0
- package/src/conversion/test/bigintToText.test.ts +30 -0
- package/src/conversion/test/bufToBigint.test.ts +20 -0
- package/src/conversion/test/hexToBigint.test.ts +22 -0
- package/src/conversion/test/hexToBuf.test.ts +39 -0
- package/src/conversion/test/parseHex.test.ts +35 -0
- package/src/conversion/test/setup.test.ts +9 -0
- package/src/conversion/test/textToBuf.test.ts +26 -0
- package/src/conversion/tsconfig.json +57 -0
- package/src/conversion/tsconfig.rollup.json +9 -0
- package/src/conversion/typedoc.json +5 -0
- package/src/conversion/types/bindings.d.t.s +4 -0
- package/src/conversion/vite.config.ts +10 -0
- package/src/conversion/vitest.config.ts +15 -0
- package/src/index.bench.ts +5 -6
- package/src/index.spec.ts +232 -358
- package/src/index.ts +33 -28
- package/.travis.yml +0 -51
- package/PR_TEMPLATE.md +0 -53
- package/dist/node.js +0 -94
- package/karma.conf.js +0 -62
- package/rollup.cjs.config.js +0 -8
- package/rollup.esm.config.js +0 -15
- package/tsconfig.json +0 -20
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / bigintToHex
|
|
6
|
+
|
|
7
|
+
# Function: bigintToHex()
|
|
8
|
+
|
|
9
|
+
> **bigintToHex**(`a`, `prefix0x`, `byteLength?`): `string`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:177
|
|
12
|
+
|
|
13
|
+
Converts a non-negative bigint to a hexadecimal string
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### a
|
|
18
|
+
|
|
19
|
+
`bigint`
|
|
20
|
+
|
|
21
|
+
a non negative bigint
|
|
22
|
+
|
|
23
|
+
### prefix0x
|
|
24
|
+
|
|
25
|
+
`boolean` = `false`
|
|
26
|
+
|
|
27
|
+
set to true to prefix the output with '0x'
|
|
28
|
+
|
|
29
|
+
### byteLength?
|
|
30
|
+
|
|
31
|
+
`number`
|
|
32
|
+
|
|
33
|
+
pad the output to have the desired byte length. Notice that the hex length is double the byte length.
|
|
34
|
+
|
|
35
|
+
## Returns
|
|
36
|
+
|
|
37
|
+
`string`
|
|
38
|
+
|
|
39
|
+
hexadecimal representation of the input bigint
|
|
40
|
+
|
|
41
|
+
## Throws
|
|
42
|
+
|
|
43
|
+
RangeError if a < 0
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / bigintToText
|
|
6
|
+
|
|
7
|
+
# Function: bigintToText()
|
|
8
|
+
|
|
9
|
+
> **bigintToText**(`a`): `string`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:204
|
|
12
|
+
|
|
13
|
+
Converts a non-negative bigint representing a binary array of utf-8 encoded text to a string of utf-8 text
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### a
|
|
18
|
+
|
|
19
|
+
`bigint`
|
|
20
|
+
|
|
21
|
+
A non-negative bigint representing a binary array of utf-8 encoded text.
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`string`
|
|
26
|
+
|
|
27
|
+
a string text with utf-8 encoding
|
|
28
|
+
|
|
29
|
+
## Throws
|
|
30
|
+
|
|
31
|
+
RangeError if a < 0.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / bufToBigint
|
|
6
|
+
|
|
7
|
+
# Function: bufToBigint()
|
|
8
|
+
|
|
9
|
+
> **bufToBigint**(`buf`): `bigint`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:154
|
|
12
|
+
|
|
13
|
+
Converts an ArrayBuffer, TypedArray or Buffer (node.js) to a bigint
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### buf
|
|
18
|
+
|
|
19
|
+
`ArrayBuffer` | `Buffer`\<`ArrayBufferLike`\> | [`TypedArray`](../type-aliases/TypedArray.md)
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
`bigint`
|
|
24
|
+
|
|
25
|
+
a bigint
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / bufToHex
|
|
6
|
+
|
|
7
|
+
# Function: bufToHex()
|
|
8
|
+
|
|
9
|
+
> **bufToHex**(`buf`, `prefix0x`, `byteLength?`): `string`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:269
|
|
12
|
+
|
|
13
|
+
Returns the hexadecimal representation of a buffer.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### buf
|
|
18
|
+
|
|
19
|
+
`ArrayBuffer` | `Buffer`\<`ArrayBufferLike`\> | [`TypedArray`](../type-aliases/TypedArray.md)
|
|
20
|
+
|
|
21
|
+
### prefix0x
|
|
22
|
+
|
|
23
|
+
`boolean` = `false`
|
|
24
|
+
|
|
25
|
+
set to true to prefix the output with '0x'
|
|
26
|
+
|
|
27
|
+
### byteLength?
|
|
28
|
+
|
|
29
|
+
`number`
|
|
30
|
+
|
|
31
|
+
pad the output to have the desired byte length. Notice that the hex length is double the byte length.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`string`
|
|
36
|
+
|
|
37
|
+
a string with a hexadecimal representation of the input buffer
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / bufToText
|
|
6
|
+
|
|
7
|
+
# Function: bufToText()
|
|
8
|
+
|
|
9
|
+
> **bufToText**(`buf`): `string`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:239
|
|
12
|
+
|
|
13
|
+
Converts an ArrayBuffer, TypedArray or Buffer (in Node.js) containing utf-8 encoded text to a string of utf-8 text
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### buf
|
|
18
|
+
|
|
19
|
+
A buffer containing utf-8 encoded text
|
|
20
|
+
|
|
21
|
+
`ArrayBuffer` | `Buffer`\<`ArrayBufferLike`\> | [`TypedArray`](../type-aliases/TypedArray.md)
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`string`
|
|
26
|
+
|
|
27
|
+
a string text with utf-8 encoding
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / hexToBigint
|
|
6
|
+
|
|
7
|
+
# Function: hexToBigint()
|
|
8
|
+
|
|
9
|
+
> **hexToBigint**(`hexStr`): `bigint`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:191
|
|
12
|
+
|
|
13
|
+
Converts a hexadecimal string to a bigint
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### hexStr
|
|
18
|
+
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
`bigint`
|
|
24
|
+
|
|
25
|
+
a bigint
|
|
26
|
+
|
|
27
|
+
## Throws
|
|
28
|
+
|
|
29
|
+
RangeError if input string does not hold an hexadecimal number
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / hexToBuf
|
|
6
|
+
|
|
7
|
+
# Function: hexToBuf()
|
|
8
|
+
|
|
9
|
+
> **hexToBuf**(`hexStr`, `returnArrayBuffer`): `ArrayBuffer` \| `Buffer`\<`ArrayBufferLike`\>
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:298
|
|
12
|
+
|
|
13
|
+
Converts a hexadecimal string to a buffer
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### hexStr
|
|
18
|
+
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
A string representing a number with hexadecimal notation
|
|
22
|
+
|
|
23
|
+
### returnArrayBuffer
|
|
24
|
+
|
|
25
|
+
`boolean` = `false`
|
|
26
|
+
|
|
27
|
+
In Node.js, it forces the output to be an ArrayBuffer instead of a Buffer.
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
`ArrayBuffer` \| `Buffer`\<`ArrayBufferLike`\>
|
|
32
|
+
|
|
33
|
+
An ArrayBuffer or a Buffer
|
|
34
|
+
|
|
35
|
+
## Throws
|
|
36
|
+
|
|
37
|
+
RangeError if input string does not hold an hexadecimal number
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / parseHex
|
|
6
|
+
|
|
7
|
+
# Function: parseHex()
|
|
8
|
+
|
|
9
|
+
> **parseHex**(`a`, `prefix0x`, `byteLength?`): `string`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:119
|
|
12
|
+
|
|
13
|
+
Parses a hexadecimal string for correctness and returns it with or without '0x' prefix, and/or with the specified byte length
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### a
|
|
18
|
+
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
the string with an hexadecimal number to be parsed
|
|
22
|
+
|
|
23
|
+
### prefix0x
|
|
24
|
+
|
|
25
|
+
`boolean` = `false`
|
|
26
|
+
|
|
27
|
+
set to true to prefix the output with '0x'
|
|
28
|
+
|
|
29
|
+
### byteLength?
|
|
30
|
+
|
|
31
|
+
`number`
|
|
32
|
+
|
|
33
|
+
pad the output to have the desired byte length. Notice that the hex length is double the byte length.
|
|
34
|
+
|
|
35
|
+
## Returns
|
|
36
|
+
|
|
37
|
+
`string`
|
|
38
|
+
|
|
39
|
+
## Throws
|
|
40
|
+
|
|
41
|
+
RangeError if input string does not hold an hexadecimal number
|
|
42
|
+
|
|
43
|
+
## Throws
|
|
44
|
+
|
|
45
|
+
RangeError if requested byte length is less than the input byte length
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / textToBigint
|
|
6
|
+
|
|
7
|
+
# Function: textToBigint()
|
|
8
|
+
|
|
9
|
+
> **textToBigint**(`text`): `bigint`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:216
|
|
12
|
+
|
|
13
|
+
Converts a utf-8 string to a bigint (from its binary representaion)
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### text
|
|
18
|
+
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
A string text with utf-8 encoding
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`bigint`
|
|
26
|
+
|
|
27
|
+
a bigint representing a binary array of the input utf-8 encoded text
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / textToBuf
|
|
6
|
+
|
|
7
|
+
# Function: textToBuf()
|
|
8
|
+
|
|
9
|
+
> **textToBuf**(`str`, `returnArrayBuffer`): `ArrayBuffer` \| `Buffer`\<`ArrayBufferLike`\>
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:253
|
|
12
|
+
|
|
13
|
+
Converts a string of utf-8 encoded text to an ArrayBuffer or a Buffer (default in Node.js)
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### str
|
|
18
|
+
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
A string of text (with utf-8 encoding)
|
|
22
|
+
|
|
23
|
+
### returnArrayBuffer
|
|
24
|
+
|
|
25
|
+
`boolean` = `false`
|
|
26
|
+
|
|
27
|
+
When invoked in Node.js, it can force the output to be an ArrayBuffer instead of a Buffer.
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
`ArrayBuffer` \| `Buffer`\<`ArrayBufferLike`\>
|
|
32
|
+
|
|
33
|
+
an ArrayBuffer or a Buffer containing the utf-8 encoded text
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / toBigIntBE
|
|
6
|
+
|
|
7
|
+
# Function: toBigIntBE()
|
|
8
|
+
|
|
9
|
+
> **toBigIntBE**(`buf`): `bigint`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:63
|
|
12
|
+
|
|
13
|
+
Convert a big-endian buffer into a BigInt
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### buf
|
|
18
|
+
|
|
19
|
+
`Buffer`
|
|
20
|
+
|
|
21
|
+
The big-endian buffer to convert.
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`bigint`
|
|
26
|
+
|
|
27
|
+
A BigInt with the big-endian representation of buf.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / toBigIntLE
|
|
6
|
+
|
|
7
|
+
# Function: toBigIntLE()
|
|
8
|
+
|
|
9
|
+
> **toBigIntLE**(`buf`): `bigint`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:36
|
|
12
|
+
|
|
13
|
+
Convert a little-endian buffer into a BigInt.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### buf
|
|
18
|
+
|
|
19
|
+
`Buffer`
|
|
20
|
+
|
|
21
|
+
The little-endian buffer to convert
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`bigint`
|
|
26
|
+
|
|
27
|
+
A BigInt with the little-endian representation of buf.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / toBufferBE
|
|
6
|
+
|
|
7
|
+
# Function: toBufferBE()
|
|
8
|
+
|
|
9
|
+
> **toBufferBE**(`num`, `width`): `Buffer`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:98
|
|
12
|
+
|
|
13
|
+
Convert a BigInt to a big-endian buffer.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### num
|
|
18
|
+
|
|
19
|
+
`bigint`
|
|
20
|
+
|
|
21
|
+
The BigInt to convert.
|
|
22
|
+
|
|
23
|
+
### width
|
|
24
|
+
|
|
25
|
+
`number`
|
|
26
|
+
|
|
27
|
+
The number of bytes that the resulting buffer should be.
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
`Buffer`
|
|
32
|
+
|
|
33
|
+
A big-endian buffer representation of num.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / toBufferLE
|
|
6
|
+
|
|
7
|
+
# Function: toBufferLE()
|
|
8
|
+
|
|
9
|
+
> **toBufferLE**(`num`, `width`): `Buffer`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:80
|
|
12
|
+
|
|
13
|
+
Convert a BigInt to a little-endian buffer.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### num
|
|
18
|
+
|
|
19
|
+
`bigint`
|
|
20
|
+
|
|
21
|
+
The BigInt to convert.
|
|
22
|
+
|
|
23
|
+
### width
|
|
24
|
+
|
|
25
|
+
`number`
|
|
26
|
+
|
|
27
|
+
The number of bytes that the resulting buffer should be.
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
`Buffer`
|
|
32
|
+
|
|
33
|
+
A little-endian buffer representation of num.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / validateBigIntBuffer
|
|
6
|
+
|
|
7
|
+
# Function: validateBigIntBuffer()
|
|
8
|
+
|
|
9
|
+
> **validateBigIntBuffer**(): `boolean`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:49
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`boolean`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[**bigint-conversion**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[bigint-conversion](../README.md) / TypedArray
|
|
6
|
+
|
|
7
|
+
# Type Alias: TypedArray
|
|
8
|
+
|
|
9
|
+
> **TypedArray** = `Int8Array` \| `Uint8Array` \| `Uint8ClampedArray` \| `Int16Array` \| `Uint16Array` \| `Int32Array` \| `Uint32Array` \| `Float32Array` \| `Float64Array` \| `BigInt64Array` \| `BigUint64Array`
|
|
10
|
+
|
|
11
|
+
Defined in: index.ts:106
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/ts/index';
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bigint-conversion",
|
|
3
|
+
"version": "2.4.3",
|
|
4
|
+
"description": "Convert to/from BigInt from/to Buffer, ArrayBuffer, hex string, utf8-encoded text string.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"BigInt",
|
|
7
|
+
"bignum",
|
|
8
|
+
"big integer",
|
|
9
|
+
"text",
|
|
10
|
+
"utf8",
|
|
11
|
+
"hex",
|
|
12
|
+
"Buffer",
|
|
13
|
+
"ArrayBuffer",
|
|
14
|
+
"TypedArray"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "Juan Hernández Serrano",
|
|
19
|
+
"email": "j.hernandez@upc.edu",
|
|
20
|
+
"url": "https://github.com/juanelas"
|
|
21
|
+
},
|
|
22
|
+
"repository": "github:juanelas/bigint-conversion",
|
|
23
|
+
"main": "./dist/cjs/index.node.js",
|
|
24
|
+
"browser": "./dist/esm/index.browser.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"node": {
|
|
29
|
+
"import": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"default": "./dist/esm/index.node.js"
|
|
32
|
+
},
|
|
33
|
+
"require": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"default": "./dist/node.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"script": "./dist/bundle.iife.js",
|
|
39
|
+
"default": {
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"default": "./dist/esm/index.browser.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"./esm-browser-bundle": "./dist/esm/bundle.min.js",
|
|
45
|
+
"./dist/esm/bundle.min.js": "./dist/esm/bundle.min.js",
|
|
46
|
+
"./esm-browser-bundle-nomin": "./dist/esm/bundle.js",
|
|
47
|
+
"./dist/esm/bundle.js": "./dist/esm/bundle.js",
|
|
48
|
+
"./iife-browser-bundle": "./dist/bundle.iife.js",
|
|
49
|
+
"./dist/bundle.iife.js": "./dist/bundle.iife.js",
|
|
50
|
+
"./umd-browser-bundle": "./dist/bundle.umd.js",
|
|
51
|
+
"./dist/bundle.umd.js": "./dist/bundle.umd.js",
|
|
52
|
+
"./dist/cjs/index.node": {
|
|
53
|
+
"types": "./dist/index.d.ts",
|
|
54
|
+
"default": "./dist/cjs/index.node.js"
|
|
55
|
+
},
|
|
56
|
+
"./dist/esm/index.node": {
|
|
57
|
+
"types": "./dist/index.d.ts",
|
|
58
|
+
"default": "./dist/esm/index.node.js"
|
|
59
|
+
},
|
|
60
|
+
"./dist/esm/index.browser": {
|
|
61
|
+
"types": "./dist/index.d.ts",
|
|
62
|
+
"default": "./dist/esm/index.browser.js"
|
|
63
|
+
},
|
|
64
|
+
"./package.json": "./package.json"
|
|
65
|
+
},
|
|
66
|
+
"imports": {
|
|
67
|
+
"#pkg": {
|
|
68
|
+
"require": {
|
|
69
|
+
"types": "./dist/index.d.ts",
|
|
70
|
+
"default": "./dist/cjs/index.node.js"
|
|
71
|
+
},
|
|
72
|
+
"import": {
|
|
73
|
+
"types": "./dist/index.d.ts",
|
|
74
|
+
"default": "./dist/esm/index.node.js"
|
|
75
|
+
},
|
|
76
|
+
"default": {
|
|
77
|
+
"types": "./dist/index.d.ts",
|
|
78
|
+
"default": "./dist/esm/index.browser.js"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"directories": {
|
|
83
|
+
"build": "./build",
|
|
84
|
+
"dist": "./dist",
|
|
85
|
+
"docs": "./docs",
|
|
86
|
+
"src": "./src",
|
|
87
|
+
"test": "./test"
|
|
88
|
+
},
|
|
89
|
+
"scripts": {
|
|
90
|
+
"_build:cleantypes": "rimraf .types",
|
|
91
|
+
"_build:cjsAndesmPkgJsons": "node ./build/bin/post-build.ts",
|
|
92
|
+
"build": "run-s build:js docs copy:types",
|
|
93
|
+
"build:js": "rollup -c build/rollup.config.ts",
|
|
94
|
+
"typecheck": "tsc --noEmit",
|
|
95
|
+
"postbuild:js": "run-s _build:cleantypes _build:cjsAndesmPkgJsons",
|
|
96
|
+
"test:node": "vitest run",
|
|
97
|
+
"clean": "rimraf coverage dist .types docs",
|
|
98
|
+
"coverage": "vitest run --coverage",
|
|
99
|
+
"docs": "typedoc --plugin typedoc-plugin-markdown --entryModule API.md --readme none --excludePrivate --out docs src/ts/index.ts",
|
|
100
|
+
"test": "vitest run",
|
|
101
|
+
"test:watch": "vitest watch",
|
|
102
|
+
"test:browser": "vitest run --browser"
|
|
103
|
+
},
|
|
104
|
+
"copy:types": "cpy ./build/index.d.ts ./dist/ --flat",
|
|
105
|
+
"ts-standard": {
|
|
106
|
+
"project": "tsconfig.json",
|
|
107
|
+
"env": [
|
|
108
|
+
"mocha"
|
|
109
|
+
],
|
|
110
|
+
"globals": [
|
|
111
|
+
"IS_BROWSER",
|
|
112
|
+
"browser",
|
|
113
|
+
"page",
|
|
114
|
+
"chai"
|
|
115
|
+
],
|
|
116
|
+
"ignore": [
|
|
117
|
+
"dist/**/*",
|
|
118
|
+
"examples/**/*",
|
|
119
|
+
"types/**/*",
|
|
120
|
+
"benchmark/**/*"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"nodeBrowserSkel": {
|
|
124
|
+
"badges": {
|
|
125
|
+
"workflow": true,
|
|
126
|
+
"coveralls": true
|
|
127
|
+
},
|
|
128
|
+
"git": {
|
|
129
|
+
"branch": "main"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"devDependencies": {
|
|
133
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
134
|
+
"@rollup/plugin-inject": "^5.0.5",
|
|
135
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
136
|
+
"@rollup/plugin-multi-entry": "^7.0.1",
|
|
137
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
138
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
139
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
140
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
141
|
+
"@types/node": "^24.10.1",
|
|
142
|
+
"c8": "^10.1.3",
|
|
143
|
+
"chai": "^6.2.0",
|
|
144
|
+
"esbuild-register": "^3.6.0",
|
|
145
|
+
"glob": "^13.0.0",
|
|
146
|
+
"json5": "^2.2.3",
|
|
147
|
+
"minimatch": "^10.0.3",
|
|
148
|
+
"mocha": "^11.7.4",
|
|
149
|
+
"npm-run-all": "^4.1.5",
|
|
150
|
+
"pirates": "^4.0.7",
|
|
151
|
+
"puppeteer": "^24.26.1",
|
|
152
|
+
"rimraf": "^6.0.1",
|
|
153
|
+
"rollup": "^4.53.3",
|
|
154
|
+
"rollup-plugin-dts": "^6.2.3",
|
|
155
|
+
"ts-standard": "^12.0.2",
|
|
156
|
+
"tslib": "^2.8.1",
|
|
157
|
+
"typedoc": "^0.28.14",
|
|
158
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
159
|
+
"typescript": "^5.9.3",
|
|
160
|
+
"vite": "7.2.4",
|
|
161
|
+
"vitest": "^4.0.3"
|
|
162
|
+
}
|
|
163
|
+
}
|