Files
common/docs/util/modules/_u8a_tobuffer_.md
T
2018-12-18 09:03:34 +00:00

838 B

Functions

u8aToBuffer

▸ u8aToBuffer(value?: Uint8Array): Buffer

Defined in u8a/toBuffer.ts:20

name: u8aToBuffer

signature: u8aToBuffer (value?: UInt8Array): Buffer

summary: Creates a Buffer object from a hex string.

description: null inputs returns an empty Buffer result. UInt8Array input values return the actual bytes value converted to a Buffer. Anything that is not a UInt8Array throws an error.

example:

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

console.log('Buffer', u8aToBuffer('0x123480001f'));

Parameters:

Name Type
Optional value Uint8Array

Returns: Buffer