Files
common/docs/util/modules/_compact_addlength_.md
T
2018-12-21 09:08:40 +00:00

859 B

Functions

compactAddLength

▸ compactAddLength(input: Uint8Array, bitLength?: BitLength): Uint8Array

Defined in compact/addLength.ts:23

name: compactAddLength

description: Adds a length prefix to the input value

example:

import { compactAddLength } from '@polkadot/util';

console.log(compactAddLength(new Uint8Array([0xde, 0xad, 0xbe, 0xef]))); // Uint8Array([4 << 2, 0xde, 0xad, 0xbe, 0xef])

Parameters:

Name Type Default value
input Uint8Array -
Default value bitLength BitLength DEFAULT_BITLENGTH

Returns: Uint8Array