@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
package/okg.md
DELETED
|
@@ -1,180 +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/cjs/index.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.js",
|
|
94
|
-
"build": "run-s lint:src build:js lint:test docs",
|
|
95
|
-
"build:js": "rollup -c build/rollup.config.mjs",
|
|
96
|
-
"postbuild:js": "run-s _build:cleantypes _build:cjsAndesmPkgJsons",
|
|
97
|
-
"clean": "rimraf .mocha-ts coverage dist .types docs",
|
|
98
|
-
"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 ",
|
|
99
|
-
"docs": "node build/build.docs.js",
|
|
100
|
-
"git:add": "git add -A",
|
|
101
|
-
"lint": "ts-standard --fix",
|
|
102
|
-
"lint:src": "ts-standard --fix \"src/**/!(*.spec|*.test).ts\"",
|
|
103
|
-
"lint:test": "ts-standard --fix \"{test/**/*.ts,src/**/*.spec.ts,src/**/*.test.ts}\"",
|
|
104
|
-
"mocha-ts": "node --experimental-modules --experimental-json-modules --es-module-specifier-resolution=node ./build/bin/mocha-ts.js ",
|
|
105
|
-
"mocha-ts:cjs": "node ./build/bin/mocha-ts.js --commonjs ",
|
|
106
|
-
"mocha-ts:watch": "npm run mocha-ts:cjs -- --watch --timeout 0",
|
|
107
|
-
"mocha-ts:browser": "node build/testing/browser/index.js ",
|
|
108
|
-
"mocha-ts:browser-headless": "node build/testing/browser/index.js headless ",
|
|
109
|
-
"preversion": "run-s clean lint:src build:js lint:test coverage test:browser-headless",
|
|
110
|
-
"version": "run-s docs git:add",
|
|
111
|
-
"postversion": "git push --follow-tags",
|
|
112
|
-
"test": "run-s test:node test:browser-headless",
|
|
113
|
-
"test:browser": "npm run mocha-ts:browser",
|
|
114
|
-
"test:browser-headless": "npm run mocha-ts:browser-headless",
|
|
115
|
-
"test:node": "run-s test:node-cjs test:node-esm",
|
|
116
|
-
"test:node-cjs": "npm run mocha-ts:cjs ",
|
|
117
|
-
"test:node-esm": "npm run mocha-ts ",
|
|
118
|
-
"watch": "npm run mocha-ts:watch "
|
|
119
|
-
},
|
|
120
|
-
"ts-standard": {
|
|
121
|
-
"project": "tsconfig.json",
|
|
122
|
-
"env": [
|
|
123
|
-
"mocha"
|
|
124
|
-
],
|
|
125
|
-
"globals": [
|
|
126
|
-
"IS_BROWSER",
|
|
127
|
-
"browser",
|
|
128
|
-
"page",
|
|
129
|
-
"chai"
|
|
130
|
-
],
|
|
131
|
-
"ignore": [
|
|
132
|
-
"dist/**/*",
|
|
133
|
-
"examples/**/*",
|
|
134
|
-
"types/**/*",
|
|
135
|
-
"benchmark/**/*"
|
|
136
|
-
]
|
|
137
|
-
},
|
|
138
|
-
"nodeBrowserSkel": {
|
|
139
|
-
"badges": {
|
|
140
|
-
"workflow": true,
|
|
141
|
-
"coveralls": true
|
|
142
|
-
},
|
|
143
|
-
"git": {
|
|
144
|
-
"branch": "main"
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
"devDependencies": {
|
|
148
|
-
"@rollup/plugin-commonjs": "^25.0.7",
|
|
149
|
-
"@rollup/plugin-inject": "^5.0.5",
|
|
150
|
-
"@rollup/plugin-json": "^6.0.1",
|
|
151
|
-
"@rollup/plugin-multi-entry": "^6.0.1",
|
|
152
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
153
|
-
"@rollup/plugin-replace": "^5.0.5",
|
|
154
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
155
|
-
"@rollup/plugin-typescript": "^11.1.5",
|
|
156
|
-
"@types/chai": "^4.3.10",
|
|
157
|
-
"@types/mocha": "^10.0.4",
|
|
158
|
-
"c8": "^8.0.1",
|
|
159
|
-
"chai": "^4.3.10",
|
|
160
|
-
"dotenv": "^16.3.1",
|
|
161
|
-
"glob": "^10.3.10",
|
|
162
|
-
"json5": "^2.2.3",
|
|
163
|
-
"minimatch": "^9.0.3",
|
|
164
|
-
"mocha": "^10.2.0",
|
|
165
|
-
"npm-run-all": "^4.1.5",
|
|
166
|
-
"pirates": "^4.0.6",
|
|
167
|
-
"puppeteer": "^21.5.1",
|
|
168
|
-
"rimraf": "^5.0.5",
|
|
169
|
-
"rollup": "^4.3.0",
|
|
170
|
-
"rollup-plugin-dts": "^6.1.0",
|
|
171
|
-
"ts-standard": "^12.0.2",
|
|
172
|
-
"tslib": "^2.6.2",
|
|
173
|
-
"typedoc": "^0.25.3",
|
|
174
|
-
"typedoc-plugin-markdown": "^3.17.1",
|
|
175
|
-
"typescript": "^5.0.0"
|
|
176
|
-
},
|
|
177
|
-
"dependencies": {
|
|
178
|
-
"@juanelas/base64": "^1.1.2"
|
|
179
|
-
}
|
|
180
|
-
}
|
package/rollup.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import replace from '@rollup/plugin-replace';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
input: 'build/src/index.js',
|
|
5
|
-
output: {
|
|
6
|
-
format: 'esm',
|
|
7
|
-
file: 'dist/node.js'
|
|
8
|
-
},
|
|
9
|
-
external: ['bindings'], // ← This is the fix
|
|
10
|
-
plugins: [
|
|
11
|
-
replace({
|
|
12
|
-
preventAssignment: true,
|
|
13
|
-
'process.browser': JSON.stringify(process.env.BROWSER === 'true')
|
|
14
|
-
})
|
|
15
|
-
]
|
|
16
|
-
}
|
package/src/conversion/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Juan Hernández Serrano
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/src/conversion/README.md
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
[](https://opensource.org/licenses/MIT)
|
|
2
|
-
[](CODE_OF_CONDUCT.md)
|
|
3
|
-
[](https://standardjs.com)
|
|
4
|
-
[](https://github.com/juanelas/bigint-conversion/actions/workflows/build-and-test.yml)
|
|
5
|
-
[](https://coveralls.io/github/juanelas/bigint-conversion?branch=main)
|
|
6
|
-
|
|
7
|
-
# bigint-conversion
|
|
8
|
-
|
|
9
|
-
Convert to/from non-negative integers represented with [ES-2020 native JS implementation of BigInt](https://tc39.es/ecma262/#sec-bigint-objects) from/to:
|
|
10
|
-
|
|
11
|
-
- `Buffer` (node.js) or `ArrayBuffer|TypedArray` (native js),
|
|
12
|
-
- hex `string`,
|
|
13
|
-
- utf8-encoded text `string`,
|
|
14
|
-
- standard and url-safe base64 with and without padding.
|
|
15
|
-
|
|
16
|
-
It provides a common interface for the conversions that works for both **node.js** and **native javascript**.
|
|
17
|
-
|
|
18
|
-
> Note that there is not a directly visible `TypedArray()` constructor, but a set of typed array ones: `Int8Array()`, `Uint8Array()`, `Uint8ClampedArray()`, `Int16Array()`, `Uint16Array()`, `Int32Array()`, `Uint32Array()`, `Float32Array()`, `Float64Array()`, `BigInt64Array()`, `BigUint64Array()`.
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
`bigint-conversion` can be imported to your project with `npm`:
|
|
23
|
-
|
|
24
|
-
```console
|
|
25
|
-
npm install bigint-conversion
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Then either require (Node.js CJS):
|
|
29
|
-
|
|
30
|
-
```javascript
|
|
31
|
-
const bigintConversion = require('bigint-conversion')
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
or import (JavaScript ES module):
|
|
35
|
-
|
|
36
|
-
```javascript
|
|
37
|
-
import * as bigintConversion from 'bigint-conversion'
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
The appropriate version for browser or node is automatically exported.
|
|
41
|
-
|
|
42
|
-
> BigInt is [ES-2020](https://tc39.es/ecma262/#sec-bigint-objects). In order to use it with TypeScript you should set `target` (and probably also `lib`) to at least `es2020` in `tsconfig.json`.
|
|
43
|
-
|
|
44
|
-
You can also download the [IIFE bundle](https://raw.githubusercontent.com/juanelas/bigint-conversion/main/dist\bundle.iife.js), the [ESM bundle](https://raw.githubusercontent.com/juanelas/bigint-conversion/main/dist\esm\bundle.min.js) or the [UMD bundle](https://raw.githubusercontent.com/juanelas/bigint-conversion/main/dist\bundle.umd.js) and manually add it to your project, or, if you have already installed `bigint-conversion` in your project, just get the bundles from `node_modules/bigint-conversion/dist/bundles/`.
|
|
45
|
-
|
|
46
|
-
## API reference documentation
|
|
47
|
-
|
|
48
|
-
[Check the API](./docs/API.md)
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
**bigint-conversion**
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
# bigint-conversion
|
|
6
|
-
|
|
7
|
-
## Type Aliases
|
|
8
|
-
|
|
9
|
-
- [TypedArray](type-aliases/TypedArray.md)
|
|
10
|
-
|
|
11
|
-
## Variables
|
|
12
|
-
|
|
13
|
-
- [isNative](variables/isNative.md)
|
|
14
|
-
|
|
15
|
-
## Functions
|
|
16
|
-
|
|
17
|
-
- [base64ToBigint](functions/base64ToBigint.md)
|
|
18
|
-
- [bigintToBase64](functions/bigintToBase64.md)
|
|
19
|
-
- [bigintToBuf](functions/bigintToBuf.md)
|
|
20
|
-
- [bigintToHex](functions/bigintToHex.md)
|
|
21
|
-
- [bigintToText](functions/bigintToText.md)
|
|
22
|
-
- [bufToBigint](functions/bufToBigint.md)
|
|
23
|
-
- [bufToHex](functions/bufToHex.md)
|
|
24
|
-
- [bufToText](functions/bufToText.md)
|
|
25
|
-
- [hexToBigint](functions/hexToBigint.md)
|
|
26
|
-
- [hexToBuf](functions/hexToBuf.md)
|
|
27
|
-
- [parseHex](functions/parseHex.md)
|
|
28
|
-
- [textToBigint](functions/textToBigint.md)
|
|
29
|
-
- [textToBuf](functions/textToBuf.md)
|
|
30
|
-
- [toBigIntBE](functions/toBigIntBE.md)
|
|
31
|
-
- [toBigIntLE](functions/toBigIntLE.md)
|
|
32
|
-
- [toBufferBE](functions/toBufferBE.md)
|
|
33
|
-
- [toBufferLE](functions/toBufferLE.md)
|
|
34
|
-
- [validateBigIntBuffer](functions/validateBigIntBuffer.md)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
[**bigint-conversion**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[bigint-conversion](../README.md) / base64ToBigint
|
|
6
|
-
|
|
7
|
-
# Function: base64ToBigint()
|
|
8
|
-
|
|
9
|
-
> **base64ToBigint**(`a`): `bigint`
|
|
10
|
-
|
|
11
|
-
Defined in: index.ts:330
|
|
12
|
-
|
|
13
|
-
Converts a base64 string to bigint.
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
### a
|
|
18
|
-
|
|
19
|
-
`string`
|
|
20
|
-
|
|
21
|
-
base64 string. It accepts standard and URL-safe base64 with and without padding
|
|
22
|
-
|
|
23
|
-
## Returns
|
|
24
|
-
|
|
25
|
-
`bigint`
|
|
26
|
-
|
|
27
|
-
a bigint
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
[**bigint-conversion**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[bigint-conversion](../README.md) / bigintToBase64
|
|
6
|
-
|
|
7
|
-
# Function: bigintToBase64()
|
|
8
|
-
|
|
9
|
-
> **bigintToBase64**(`a`, `urlsafe`, `padding`): `string`
|
|
10
|
-
|
|
11
|
-
Defined in: index.ts:321
|
|
12
|
-
|
|
13
|
-
Converts an arbitrary-size non-negative bigint to a base64 string
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
### a
|
|
18
|
-
|
|
19
|
-
`bigint`
|
|
20
|
-
|
|
21
|
-
a non negative bigint
|
|
22
|
-
|
|
23
|
-
### urlsafe
|
|
24
|
-
|
|
25
|
-
`boolean` = `false`
|
|
26
|
-
|
|
27
|
-
if true Base64 URL encoding is used ('+' and '/' are replaced by '-', '_')
|
|
28
|
-
|
|
29
|
-
### padding
|
|
30
|
-
|
|
31
|
-
`boolean` = `true`
|
|
32
|
-
|
|
33
|
-
if false, padding (trailing '=') is removed
|
|
34
|
-
|
|
35
|
-
## Returns
|
|
36
|
-
|
|
37
|
-
`string`
|
|
38
|
-
|
|
39
|
-
a base64 representation of the input bigint
|
|
40
|
-
|
|
41
|
-
## Throws
|
|
42
|
-
|
|
43
|
-
Thrown if a < 0
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
[**bigint-conversion**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[bigint-conversion](../README.md) / bigintToBuf
|
|
6
|
-
|
|
7
|
-
# Function: bigintToBuf()
|
|
8
|
-
|
|
9
|
-
> **bigintToBuf**(`a`, `returnArrayBuffer`): `ArrayBuffer` \| `Buffer`\<`ArrayBufferLike`\>
|
|
10
|
-
|
|
11
|
-
Defined in: index.ts:144
|
|
12
|
-
|
|
13
|
-
Converts an arbitrary-size non-negative bigint to an ArrayBuffer or a Buffer (default for Node.js)
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
### a
|
|
18
|
-
|
|
19
|
-
`bigint`
|
|
20
|
-
|
|
21
|
-
### returnArrayBuffer
|
|
22
|
-
|
|
23
|
-
`boolean` = `false`
|
|
24
|
-
|
|
25
|
-
In Node.js, it forces the output to be an ArrayBuffer instead of a Buffer.
|
|
26
|
-
|
|
27
|
-
## Returns
|
|
28
|
-
|
|
29
|
-
`ArrayBuffer` \| `Buffer`\<`ArrayBufferLike`\>
|
|
30
|
-
|
|
31
|
-
an ArrayBuffer or a Buffer with a binary representation of the input bigint
|
|
32
|
-
|
|
33
|
-
## Throws
|
|
34
|
-
|
|
35
|
-
RangeError if a < 0.
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
|
@@ -1,31 +0,0 @@
|
|
|
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.
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|