export function addRoot(writer: CarBufferWriter, root: CID, options?: {
    resize?: boolean;
}): void;
export function blockLength({ cid, bytes }: Block): number;
export function addBlock(writer: CarBufferWriter, { cid, bytes }: Block): void;
export function close(writer: CarBufferWriter, options?: {
    resize?: boolean | undefined;
}): Uint8Array<ArrayBufferLike>;
export function resizeHeader(writer: CarBufferWriter, byteLength: number): void;
export function calculateHeaderLength(rootLengths: number[]): number;
export function headerLength({ roots }: {
    roots: CID[];
}): number;
export function estimateHeaderLength(rootCount: number, rootByteLength?: number): number;
export function createWriter(buffer: ArrayBuffer, options?: {
    roots?: import("multiformats/cid").CID<any, number, number, import("multiformats").Version>[] | undefined;
    byteOffset?: number | undefined;
    byteLength?: number | undefined;
    headerSize?: number | undefined;
}): CarBufferWriter;
export type CID = import("./api.js").CID;
export type Block = import("./api.js").Block;
export type Writer = import("./api.js").CarBufferWriter;
export type Options = import("./api.js").CarBufferWriterOptions;
export type CarEncoder = import("./coding.js").CarEncoder;
/**
 * @typedef {import('./api.js').CID} CID
 * @typedef {import('./api.js').Block} Block
 * @typedef {import('./api.js').CarBufferWriter} Writer
 * @typedef {import('./api.js').CarBufferWriterOptions} Options
 * @typedef {import('./coding.js').CarEncoder} CarEncoder
 */
/**
 * A simple CAR writer that writes to a pre-allocated buffer.
 *
 * @class
 * @name CarBufferWriter
 * @implements {Writer}
 */
declare class CarBufferWriter implements Writer {
    /**
     * @param {Uint8Array} bytes
     * @param {number} headerSize
     */
    constructor(bytes: Uint8Array, headerSize: number);
    /** @readonly */
    readonly bytes: Uint8Array<ArrayBufferLike>;
    byteOffset: number;
    /**
     * @readonly
     * @type {CID[]}
     */
    readonly roots: CID[];
    headerSize: number;
    /**
     * Add a root to this writer, to be used to create a header when the CAR is
     * finalized with {@link CarBufferWriter.close `close()`}
     *
     * @param {CID} root
     * @param {{resize?:boolean}} [options]
     * @returns {CarBufferWriter}
     */
    addRoot(root: CID, options?: {
        resize?: boolean;
    }): CarBufferWriter;
    /**
     * Write a `Block` (a `{ cid:CID, bytes:Uint8Array }` pair) to the archive.
     * Throws if there is not enough capacity.
     *
     * @param {Block} block - A `{ cid:CID, bytes:Uint8Array }` pair.
     * @returns {CarBufferWriter}
     */
    write(block: Block): CarBufferWriter;
    /**
     * Finalize the CAR and return it as a `Uint8Array`.
     *
     * @param {object} [options]
     * @param {boolean} [options.resize]
     * @returns {Uint8Array}
     */
    close(options?: {
        resize?: boolean | undefined;
    }): Uint8Array;
}
export {};
//# sourceMappingURL=buffer-writer.d.ts.map