import { Uint8ArrayList } from 'uint8arraylist';
import type { AbortOptions } from 'abort-error';
import type { ByteStreamOpts } from 'it-byte-stream';
import type { Duplex } from 'it-stream-types';
export interface LengthPrefixedStream<Stream = unknown> {
    /**
     * Read the next length-prefixed number of bytes from the stream
     */
    read(options?: AbortOptions): Promise<Uint8ArrayList>;
    /**
     * Write the passed bytes to the stream prefixed by their length
     */
    write(input: Uint8Array | Uint8ArrayList, options?: AbortOptions): Promise<void>;
    /**
     * Write passed list of bytes, prefix by their individual lengths to the stream as a single write
     */
    writeV(input: Array<Uint8Array | Uint8ArrayList>, options?: AbortOptions): Promise<void>;
    /**
     * Returns the underlying stream
     */
    unwrap(): Stream;
}
export interface LengthPrefixedStreamOpts extends ByteStreamOpts {
    lengthEncoder(value: number): Uint8ArrayList | Uint8Array;
    lengthDecoder(data: Uint8ArrayList): number;
    maxLengthLength: number;
    maxDataLength: number;
}
export declare function lpStream<Stream extends Duplex<any, any, any>>(duplex: Stream, opts?: Partial<LengthPrefixedStreamOpts>): LengthPrefixedStream<Stream>;
//# sourceMappingURL=index.d.ts.map