import type { Field } from "./field/index.js"; export declare const EmptyUint8Array: Uint8Array; export interface Converter { convert: (value: From) => To; back: (value: To) => From; } export interface BufferLengthConverter extends Converter { field: K; } /** * Create a fixed-length `Uint8Array` field. * * @param length Length of the field */ export declare function buffer(length: number): Field; /** * Create a custom-typed field, backed by a fixed-length `Uint8Array`. * * @param length Length of the field * @param converter A value converter to convert between `Uint8Array` and the target type */ export declare function buffer(length: number, converter: Converter): Field; /** * Create a variable-length `Uint8Array` field. * The length is determined by another number-typed field. * * @param lengthField Name of the length field. Must be declared before this field */ export declare function buffer(lengthField: K): Field, Uint8Array>; /** * Create a custom-typed field, backed by a variable-length `Uint8Array`. * The length is determined by another number-typed field. * * @param lengthField Name of the length field. Must be declared before this field * @param converter A value converter to convert between `Uint8Array` and the target type */ export declare function buffer(lengthField: K, converter: Converter): Field, Uint8Array>; /** * Create a variable-length `Uint8Array` field. * The length is determined by converting another field to `number`. * * @param length * Name of the length field, * and a converter to convert between source type and `number`. * Must be declared before this field */ export declare function buffer(length: BufferLengthConverter): Field, Uint8Array>; /** * Create a custom-typed field, backed by a variable-length `Uint8Array`. * The length is determined by converting another field to `number`. * * @param length * Name of the length field, * and a converter to convert between source type and `number`. * Must be declared before this field * @param converter * A value converter to convert between `Uint8Array` and the target type */ export declare function buffer(length: BufferLengthConverter, converter: Converter): Field, Uint8Array>; /** * Create a length field, and a variable-length `Uint8Array` field. * This is a shortcut when the length field is directly before the data field. * * @param length The length field declaration */ export declare function buffer(length: Field): Field; /** * Create a length field, and a custom-typed field, backed by a variable-length `Uint8Array`. * This is a shortcut when the length field is directly before the data field. * * @param length The length field declaration * @param converter A value converter to convert between `Uint8Array` and the target type */ export declare function buffer(length: Field, converter: Converter): Field; //# sourceMappingURL=buffer.d.ts.map