UNPKG

517 BTypeScriptView Raw
1/// <reference types="node" />
2/**
3 * @name bufferToU8a
4 * @summary Creates a Uint8Array value from a Buffer object.
5 * @description
6 * `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.
7 * @example
8 * <BR>
9 *
10 * ```javascript
11 * import { bufferToU8a } from '@polkadot/util';
12 *
13 * bufferToU8a(Buffer.from([1, 2, 3]));
14 * ```
15 */
16export declare function bufferToU8a(buffer?: Buffer | number[] | null): Uint8Array;