import { TrieMap } from "@sec-ant/trie-map"; import { BData } from "./utils/codec.js"; /** * encoder hook */ export type EncoderHook = (result: IteratorResult) => void; /** * encoder hook path */ export type EncoderHookPath = Iterable; /** * encoder hook system */ export type EncoderHookSystem = TrieMap; /** * Bencode * @param data * @param hookSystem * @returns readable stream of the bencoded data */ export declare function encode(data: BData, hookSystem?: EncoderHookSystem): ReadableStream; /** * Register a hook and consume the result as an uint8 array readable stream * @param path * @param hookSystem * @returns an uint8 array readable stream */ export declare function useUint8ArrayStreamHook(path: EncoderHookPath, hookSystem: EncoderHookSystem): ReadableStream; /** * Register a hook and consume the result as an array buffer promise * @param path * @param hookSystem * @returns an array buffer promise */ export declare function useArrayBufferPromiseHook(path: EncoderHookPath, hookSystem: EncoderHookSystem): Promise; /** * Register a hook and consume the result as a text promise * @param path * @param hookSystem * @returns a text promise */ export declare function useTextPromiseHook(path: EncoderHookPath, hookSystem: EncoderHookSystem): Promise;