Package Exports
- bigint-conversion
- bigint-conversion/dist/bundle.iife.js
- bigint-conversion/dist/bundle.umd.js
- bigint-conversion/dist/cjs/index.node
- bigint-conversion/dist/esm/bundle.js
- bigint-conversion/dist/esm/bundle.min.js
- bigint-conversion/dist/esm/index.browser
- bigint-conversion/dist/esm/index.node
- bigint-conversion/esm-browser-bundle
- bigint-conversion/esm-browser-bundle-nomin
- bigint-conversion/iife-browser-bundle
- bigint-conversion/package.json
- bigint-conversion/umd-browser-bundle
Readme
bigint-conversion
Convert to/from non-negative integers represented with ES-2020 native JS implementation of BigInt from/to:
Buffer
(node.js) orArrayBuffer|TypedArray
(native js),- hex
string
, - utf8-encoded text
string
, - standard and url-safe base64 with and without padding.
It provides a common interface for the conversions that works for both node.js and native javascript.
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()
.
Usage
bigint-conversion
can be imported to your project with npm
:
npm install bigint-conversion
Then either require (Node.js CJS):
const bigintConversion = require('bigint-conversion')
or import (JavaScript ES module):
import * as bigintConversion from 'bigint-conversion'
The appropriate version for browser or node is automatically exported.
BigInt is ES-2020. In order to use it with TypeScript you should set
target
(and probably alsolib
) to at leastes2020
intsconfig.json
.
You can also download the IIFE bundle, the ESM bundle or the UMD bundle 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/
.