@junobuild/utils
Version:
A collection of utilities and constants for Juno JS libs.
15 lines (14 loc) • 608 B
TypeScript
/**
* Converts data to a Uint8Array for transmission or storage.
* @template T
* @param {T} data - The data to convert.
* @returns {Promise<Uint8Array>} A promise that resolves to a Uint8Array representation of the data.
*/
export declare const toArray: <T>(data: T) => Promise<Uint8Array>;
/**
* Converts a Uint8Array or number array back to the original data type.
* @template T
* @param {(Uint8Array | number[])} data - The array to convert.
* @returns {Promise<T>} A promise that resolves to the original data.
*/
export declare const fromArray: <T>(data: Uint8Array | number[]) => Promise<T>;