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

836 B

Functions

bufferToU8a

▸ bufferToU8a(buffer?: * Buffer | number[]*): Uint8Array

Defined in buffer/toU8a.ts:20

name: bufferToU8a

signature: bufferToU8a (value?: Buffer): string

summary: Creates a Uint8Array value from a Buffer object.

description: null inputs returns an empty result, Buffer values return the actual value as a Uint8Array. Anything that is not a Buffer object throws an error.

example:

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

bufferToU8a(Buffer.from([1, 2, 3]));

Parameters:

Name Type
Optional buffer Buffer | number[]

Returns: Uint8Array