z85-codec
Version:
Z85 - ZeroMQ's ascii85 encoding format
21 lines (20 loc) • 898 B
TypeScript
/**
* Encode data with the Z85 codec
*
* @param data - data to encode.
* Length needs to be divisible by 4 otherwise null is returned.
* String needs to be encoded in UTF-8.
* @returns encoded data as string or null when encoding is not possible
* @see {@link https://github.com/zeromq/rfc/blob/master/src/spec_32.c} for the used reference implementation
*/
export declare function encode(data: Uint8Array | string): string | null;
/**
* Decode data with the Z85 codec
*
* @param string - string to decode.
* Length needs to be divisible by 5 otherwise null is returned.
* Needs to be encoded in UTF-8.
* @returns decoded string as Uint8Array or null when decoding is not possible
* @see {@link https://github.com/zeromq/rfc/blob/master/src/spec_32.c} for the used reference implementation
*/
export declare function decode(string: string): Uint8Array | null;