@gsknnft/bigint-buffer 1.3.0 → 1.3.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 +16 -8
- package/dist/index.cjs +205 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +203 -0
- package/dist/node.js +19 -4
- package/helper/bigint.d.ts +2 -2
- package/package.json +11 -78
- package/rollup.cjs.config.js +8 -0
- package/rollup.esm.config.js +15 -0
- package/src/index.bench.ts +119 -116
- package/src/index.spec.ts +234 -43
- package/src/index.ts +149 -39
- package/tsconfig.json +2 -5
- package/.eslintrc +0 -5
- package/dist/index.bench.d.ts +0 -1
- package/dist/index.spec.d.ts +0 -1
- package/okg.md +0 -180
- package/rollup.config.js +0 -16
- package/src/conversion/LICENSE +0 -21
- package/src/conversion/README.md +0 -48
- package/src/conversion/docs/README.md +0 -34
- package/src/conversion/docs/functions/base64ToBigint.md +0 -27
- package/src/conversion/docs/functions/bigintToBase64.md +0 -43
- package/src/conversion/docs/functions/bigintToBuf.md +0 -35
- package/src/conversion/docs/functions/bigintToHex.md +0 -43
- package/src/conversion/docs/functions/bigintToText.md +0 -31
- package/src/conversion/docs/functions/bufToBigint.md +0 -25
- package/src/conversion/docs/functions/bufToHex.md +0 -37
- package/src/conversion/docs/functions/bufToText.md +0 -27
- package/src/conversion/docs/functions/hexToBigint.md +0 -29
- package/src/conversion/docs/functions/hexToBuf.md +0 -37
- package/src/conversion/docs/functions/parseHex.md +0 -45
- package/src/conversion/docs/functions/textToBigint.md +0 -27
- package/src/conversion/docs/functions/textToBuf.md +0 -33
- package/src/conversion/docs/functions/toBigIntBE.md +0 -27
- package/src/conversion/docs/functions/toBigIntLE.md +0 -27
- package/src/conversion/docs/functions/toBufferBE.md +0 -33
- package/src/conversion/docs/functions/toBufferLE.md +0 -33
- package/src/conversion/docs/functions/validateBigIntBuffer.md +0 -15
- package/src/conversion/docs/type-aliases/TypedArray.md +0 -11
- package/src/conversion/docs/variables/isNative.md +0 -11
- package/src/conversion/example.cjs +0 -9
- package/src/conversion/example.esm.js +0 -11
- package/src/conversion/package.json +0 -182
- package/src/conversion/pnpm-lock.yaml +0 -5571
- package/src/conversion/tsconfig.rollup.json +0 -9
- package/src/conversion/typedoc.json +0 -5
- package/src/types/bindings.d.t.s +0 -4
- package/tsconfig.lint.json +0 -5
- package/vitest.config.ts +0 -10
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
|
@@ -1,27 +0,0 @@
|
|
|
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.
|
|
@@ -1,27 +0,0 @@
|
|
|
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.
|
|
@@ -1,33 +0,0 @@
|
|
|
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.
|
|
@@ -1,33 +0,0 @@
|
|
|
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.
|
|
@@ -1,15 +0,0 @@
|
|
|
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`
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
|
@@ -1,182 +0,0 @@
|
|
|
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
|
-
"benchmark": "./benchmark",
|
|
89
|
-
"mocha-ts": "./.mocha-ts"
|
|
90
|
-
},
|
|
91
|
-
"scripts": {
|
|
92
|
-
"_build:cleantypes": "rimraf .types",
|
|
93
|
-
"_build:cjsAndesmPkgJsons": "node ./build/bin/post-build.ts",
|
|
94
|
-
"build": "run-s build:js docs",
|
|
95
|
-
"build:js": "rollup -c build/rollup.config.ts",
|
|
96
|
-
"typecheck": "tsc --noEmit",
|
|
97
|
-
"postbuild:js": "run-s _build:cleantypes _build:cjsAndesmPkgJsons",
|
|
98
|
-
"test:node": "mocha --loader ts-node/esm file://$(pwd)/src/**/*.spec.ts --timeout 40000",
|
|
99
|
-
"clean": "rimraf .mocha-ts coverage dist .types docs",
|
|
100
|
-
"coverage": "c8 --clean --check-coverage --exclude \"{src/ts/**/*.spec.ts,src/ts/**/*.test.ts,test,test-vectors,build}\" --exclude-after-remap --reporter=text --reporter=lcov node ./build/bin/mocha-ts.js --commonjs ",
|
|
101
|
-
"docs": "typedoc --plugin typedoc-plugin-markdown --entryModule API.md --readme none --excludePrivate --out docs src/ts/index.ts",
|
|
102
|
-
"mocha-ts": "node --experimental-modules --experimental-json-modules --es-module-specifier-resolution=node ./build/bin/mocha-ts.js ",
|
|
103
|
-
"mocha-ts:cjs": "node ./build/bin/mocha-ts.js --commonjs ",
|
|
104
|
-
"mocha-ts:watch": "npm run mocha-ts:cjs -- --watch --timeout 0",
|
|
105
|
-
"mocha-ts:browser": "node build/testing/browser/index.js ",
|
|
106
|
-
"mocha-ts:browser-headless": "node build/testing/browser/index.js headless ",
|
|
107
|
-
"preversion": "run-s clean build:js coverage test:browser-headless",
|
|
108
|
-
"version": "run-s docs git:add",
|
|
109
|
-
"postversion": "git push --follow-tags",
|
|
110
|
-
"test": "run-s test:node test:browser-headless",
|
|
111
|
-
"test:browser": "npm run mocha-ts:browser",
|
|
112
|
-
"test:browser-headless": "npm run mocha-ts:browser-headless",
|
|
113
|
-
"test:node:og": "run-s test:node-cjs test:node-esm",
|
|
114
|
-
"test:node-cjs": "npm run mocha-ts:cjs ",
|
|
115
|
-
"test:node-esm": "npm run mocha-ts ",
|
|
116
|
-
"watch": "npm run mocha-ts:watch "
|
|
117
|
-
},
|
|
118
|
-
"ts-standard": {
|
|
119
|
-
"project": "tsconfig.json",
|
|
120
|
-
"env": [
|
|
121
|
-
"mocha"
|
|
122
|
-
],
|
|
123
|
-
"globals": [
|
|
124
|
-
"IS_BROWSER",
|
|
125
|
-
"browser",
|
|
126
|
-
"page",
|
|
127
|
-
"chai"
|
|
128
|
-
],
|
|
129
|
-
"ignore": [
|
|
130
|
-
"dist/**/*",
|
|
131
|
-
"examples/**/*",
|
|
132
|
-
"types/**/*",
|
|
133
|
-
"benchmark/**/*"
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
"nodeBrowserSkel": {
|
|
137
|
-
"badges": {
|
|
138
|
-
"workflow": true,
|
|
139
|
-
"coveralls": true
|
|
140
|
-
},
|
|
141
|
-
"git": {
|
|
142
|
-
"branch": "main"
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
"devDependencies": {
|
|
146
|
-
"@rollup/plugin-commonjs": "^28.0.9",
|
|
147
|
-
"@rollup/plugin-inject": "^5.0.5",
|
|
148
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
149
|
-
"@rollup/plugin-multi-entry": "^7.0.1",
|
|
150
|
-
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
151
|
-
"@rollup/plugin-replace": "^6.0.2",
|
|
152
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
153
|
-
"@rollup/plugin-typescript": "^12.3.0",
|
|
154
|
-
"@types/chai": "^5.2.3",
|
|
155
|
-
"@types/mocha": "^10.0.10",
|
|
156
|
-
"c8": "^10.1.3",
|
|
157
|
-
"chai": "^6.2.0",
|
|
158
|
-
"esbuild-register": "^3.6.0",
|
|
159
|
-
"glob": "^11.0.3",
|
|
160
|
-
"json5": "^2.2.3",
|
|
161
|
-
"minimatch": "^10.0.3",
|
|
162
|
-
"mocha": "^11.7.4",
|
|
163
|
-
"npm-run-all": "^4.1.5",
|
|
164
|
-
"pirates": "^4.0.7",
|
|
165
|
-
"puppeteer": "^24.26.1",
|
|
166
|
-
"rimraf": "^6.0.1",
|
|
167
|
-
"rollup": "^4.52.5",
|
|
168
|
-
"rollup-plugin-dts": "^6.2.3",
|
|
169
|
-
"ts-standard": "^12.0.2",
|
|
170
|
-
"tslib": "^2.8.1",
|
|
171
|
-
"typedoc": "^0.28.14",
|
|
172
|
-
"typedoc-plugin-markdown": "^4.9.0",
|
|
173
|
-
"typescript": "^5.9.3",
|
|
174
|
-
"vitest": "^4.0.3"
|
|
175
|
-
},
|
|
176
|
-
"peerDependencies": {
|
|
177
|
-
"@juanelas/base64": "^1.1.5"
|
|
178
|
-
},
|
|
179
|
-
"dependencies": {
|
|
180
|
-
"yaml": "^2.8.1"
|
|
181
|
-
}
|
|
182
|
-
}
|