tar
    Preparing search index...

    Class Parser<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.

    Type Parameters

    Index

    Constructors

    Properties

    maxMetaEntrySize: number
    offset: number = 0

    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.

    position: number = 0

    The number of input bytes up to the end of the last complete entry that is not a meta entry.

    Accessors

    • get bodyRemain(): number

      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.

      Returns number

    Methods

    • Tell the parser that the input is complete.

      Returns void

    • The next event. undefined means that the parser needs more input, or after the end event, that it is done.

      Returns ParseEvent<E> | undefined

    • 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.

      Parameters

      • chunk: Uint8Array

      Returns void

    • Count the bodyRemain bytes as parsed. The next input is the header after the body.

      Returns void

    • Report a problem to onwarn. Throws if strict is set, or if data.recoverable is false.

      Parameters

      • code: string
      • message: string | Error
      • Optionaldata: WarnData

      Returns void