https://github.com/fabiospampinato/bigint-encoding
BigInt encoding, a simple way to convert Uint8Arrays into BigInts, and vice versa.
https://github.com/fabiospampinato/bigint-encoding
bigint encoding uint8array
Last synced: 3 months ago
JSON representation
BigInt encoding, a simple way to convert Uint8Arrays into BigInts, and vice versa.
- Host: GitHub
- URL: https://github.com/fabiospampinato/bigint-encoding
- Owner: fabiospampinato
- License: mit
- Created: 2023-08-08T00:46:43.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-01-15T02:37:06.000Z (12 months ago)
- Last Synced: 2025-09-19T00:02:27.744Z (3 months ago)
- Topics: bigint, encoding, uint8array
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# BigInt Encoding
BigInt encoding, a simple way to convert Uint8Arrays into BigInts, and vice versa.
## Install
```sh
npm install bigint-encoding
```
## Usage
```ts
import BigEnc from 'bigint-encoding';
// It can convert a Uint8Array into a BigInt
const uint8 = new Uint8Array ([ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ]);
const encoded = BigEnc.encode ( uint8 ); // => 22405534230753928650781647905n
// It can also go the other way, and covnert a BigInt into a Uint8Array
const decoded = BigEnc.decode ( encoded ); // => Uint8Array(12) [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]
```
## License
MIT © Fabio Spampinato