import { Header } from './header.js';
import { Pax } from './pax.js';
import { type ParserOptions } from './options.js';
import { EntryData } from './read-entry.js';
import { type WarnData } from './warn.js';
/** What `Parser.next()` returns. */
export type ParseEvent<E extends EntryData = EntryData> = 
/**
 * An entry that is not a PAX or GNU meta entry. If `entry.ignore`
 * is set, the parser skips the body, and no other event follows
 * for this entry.
 */
{
    type: 'entry';
    entry: E;
}
/** A part of the body of the entry. A view into the input. */
 | {
    type: 'body';
    data: Uint8Array;
}
/** The end of the body of the entry. */
 | {
    type: 'entryEnd';
}
/** The end of the archive. No event follows. */
 | {
    type: 'end';
};
/** Makes the entry object for a header. */
export type CreateEntry<E extends EntryData> = (header: Header, ex: Pax | undefined, gex: Pax | undefined) => E;
/**
 * A tar parser that the caller pulls. Give it input with `push()`,
 * and call `next()` for each event until it returns `undefined`.
 * Then give it more input, or call `end()` and call `next()` again.
 *
 * It does not decompress. It calls no code of the caller but
 * `filter`, `onwarn`, and the function that makes the entry objects.
 *
 * With `strict`, `next()` throws at each problem. The parser stays
 * usable: the next call continues after the block with the problem.
 */
export declare class Parser<E extends EntryData = EntryData> {
    #private;
    maxMetaEntrySize: number;
    /**
     * The number of input bytes up to the end of the last complete
     * entry that is not a meta entry.
     */
    position: number;
    /**
     * The number of input bytes that are parsed: the header blocks and
     * the body blocks. At an `entry` event, it is the place of the body
     * of the entry in the input.
     */
    offset: number;
    /**
     * @param createEntry makes the object for each entry event. It is
     * required if `E` is not `EntryData`.
     */
    constructor(opt?: ParserOptions<E>, createEntry?: CreateEntry<E>);
    /**
     * Report a problem to `onwarn`. Throws if `strict` is set, or if
     * `data.recoverable` is false.
     */
    warn(code: string, message: string | Error, data?: WarnData): void;
    /**
     * Add input. The parser keeps the chunk until `next()` returns
     * `undefined`, and each body event is a view into it. Input after
     * `end()`, or after the end of the archive, is dropped.
     */
    push(chunk: Uint8Array): void;
    /** Tell the parser that the input is complete. */
    end(): void;
    /**
     * The number of bytes of the body of the current entry, with its
     * padding, that are after the input given so far. The caller can
     * skip them in its input, and call `skipBody()`. It is 0 if the
     * parser has input that it did not parse, and in a PAX or GNU
     * header, because the parser reads that body.
     */
    get bodyRemain(): number;
    /**
     * Count the `bodyRemain` bytes as parsed. The next input is the
     * header after the body.
     */
    skipBody(): void;
    /**
     * The next event. `undefined` means that the parser needs more
     * input, or after the `end` event, that it is done.
     */
    next(): ParseEvent<E> | undefined;
}
//# sourceMappingURL=parser.d.ts.map