936 B
936 B
Functions
compactFromU8a
▸ compactFromU8a(_input: Uint8Array | string, bitLength?: BitLength): [number, BN]
Defined in compact/fromU8a.ts:26
name: compactFromU8a
description: Retrievs the offset and encoded length from a compact-prefixed value
example:
import { compactFromU8a } from '@polkadot/util';
const [offset, length] = compactFromU8a(new Uint8Array([254, 255, 3, 0]), 32));
console.log('value offset=', offset, 'length=', length); // 4, 0xffff
Parameters:
| Name | Type | Default value |
|---|---|---|
| _input | Uint8Array |
string |
Default value bitLength |
BitLength | DEFAULT_BITLENGTH |
Returns: [number, BN]