mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-22 09:08:03 +00:00
17 lines
583 B
TypeScript
17 lines
583 B
TypeScript
import type { BufferObject } from '../types.js';
|
|
/**
|
|
* @name u8aToBuffer
|
|
* @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
|
|
* <BR>
|
|
*
|
|
* ```javascript
|
|
* import { u8aToBuffer } from '@pezkuwi/util';
|
|
*
|
|
* console.log('Buffer', u8aToBuffer(new Uint8Array([1, 2, 3])));
|
|
* ```
|
|
*/
|
|
export declare function u8aToBuffer<T = BufferObject>(value?: Uint8Array | null): T;
|