@dfinity/candid
Version:
JavaScript and TypeScript library to work with candid interfaces
65 lines • 2.07 kB
TypeScript
import { PipeArrayBuffer as Pipe } from './buffer.ts';
/**
*
* @param pipe Pipe from buffer-pipe
* @param num number
* @returns Uint8Array
*/
export declare function safeRead(pipe: Pipe, num: number): Uint8Array;
/**
* @param pipe - PipeArrayBuffer simulating buffer-pipe api
*/
export declare function safeReadUint8(pipe: Pipe): number;
/**
* Encode a positive number (or bigint) into a Buffer. The number will be floored to the
* nearest integer.
* @param value The number to encode.
*/
export declare function lebEncode(value: bigint | number): Uint8Array;
/**
* Decode a leb encoded buffer into a bigint. The number will always be positive (does not
* support signed leb encoding).
* @param pipe A Buffer containing the leb encoded bits.
*/
export declare function lebDecode(pipe: Pipe): bigint;
/**
* Encode a number (or bigint) into a Buffer, with support for negative numbers. The number
* will be floored to the nearest integer.
* @param value The number to encode.
*/
export declare function slebEncode(value: bigint | number): Uint8Array;
/**
* Decode a leb encoded buffer into a bigint. The number is decoded with support for negative
* signed-leb encoding.
* @param pipe A Buffer containing the signed leb encoded bits.
*/
export declare function slebDecode(pipe: Pipe): bigint;
/**
*
* @param value bigint or number
* @param byteLength number
* @returns Uint8Array
*/
export declare function writeUIntLE(value: bigint | number, byteLength: number): Uint8Array;
/**
*
* @param value - bigint or number
* @param byteLength - number
* @returns Uint8Array
*/
export declare function writeIntLE(value: bigint | number, byteLength: number): Uint8Array;
/**
*
* @param pipe Pipe from buffer-pipe
* @param byteLength number
* @returns bigint
*/
export declare function readUIntLE(pipe: Pipe, byteLength: number): bigint;
/**
*
* @param pipe Pipe from buffer-pipe
* @param byteLength number
* @returns bigint
*/
export declare function readIntLE(pipe: Pipe, byteLength: number): bigint;
//# sourceMappingURL=leb128.d.ts.map