2.2.22 • Published 6 months ago

@substrate-system/uint8-util v2.2.22

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Uint8 Utilities

types module semantic versioning Common Changelog install size license

This libraries brings features from Node's Buffer to JS's Uint8Arrays and in some cases other Typed Arrays, in the fastest ways possible, often faster than Node's own Buffer's methods.

Contents

install

npm i -S @substrate-system/uint8-util

Usage

import {
    arr2text,
    text2arr,
    arr2hex,
    hex2arr,
    arr2base,
    base2arr
} from '@substrate-system/uint8-util'

const str = arr2text(new Uint8Array([1, 2, 3]))

const uint8 = text2arr('uflnpq')

const hexString = arr2hex(new Uint8Array([1, 2, 3]))

const uint8 = hex2arr('abc')

const base64String = arr2base(new Uint8Array([89, 87, 74, 106, 77, 84, 73]))

const uint8 = base2arr('YWJjMTI')

import { concat, equal, hash, randomBytes } from '@substrate-system/uint8-util'

const joined = concat([[1,2,3], new Uint8Array([1, 2, 3])])

const same = equal([1,2,3], [1,2,3])

const hash = await hash('mystring')

const hash = await hash(new Uint8Array([1, 2, 3]))

const rand = arr2hex(randomBytes(128))
2.2.22

6 months ago

2.2.21

6 months ago

2.2.20

7 months ago

2.2.19

7 months ago

2.2.18

7 months ago

2.2.17

7 months ago

2.2.16

7 months ago

2.2.15

7 months ago

2.2.14

7 months ago

2.2.13

7 months ago

2.2.12

7 months ago

2.2.11

7 months ago

2.2.10

7 months ago

2.2.9

7 months ago

2.2.8

7 months ago

2.2.7

7 months ago

2.2.6

7 months ago

2.2.5

7 months ago