@obsidize/tar-browserify
    Preparing search index...

    Class ArchiveEntry

    Container for metadata and content of a tarball entry.

    Here, we consider an "entry" to be a tuple of:

    1. The parsed USTAR header sector content (AKA TarHeader)
    2. The aggregate of the proceeding file content sectors, based on the header's file size attribute

    Implements

    Index

    Constructors

    Accessors

    • get content(): undefined | null | Uint8Array<ArrayBufferLike>

      The file content for this entry. This may be null for entries loaded asynchronously, or for non-file entries like directories.

      Returns undefined | null | Uint8Array<ArrayBufferLike>

    • get sourceOffset(): number

      The starting absolute index (inclusive) in the source buffer that this entry was parsed from. Returns zero by default if this was not parsed by a source buffer.

      Returns number

    Methods

    • Only necessary if this entry was extracted from an async buffer, since the entry does not hold the content of async buffers by default.

      If the entry was extracted synchronously, its content will be available via the "content" property.

      Do not use this on entries that have not been parsed from a source buffer, otherwise it will very likely return garbage data.

      Prefer to use readNextContentChunk over this when possible, as using this during archive read iteration can cause double-loading of the same data and reduce performance.

      Parameters

      • buffer: AsyncUint8ArrayLike

        the source to read content from

      • offset: number = 0

        the relative offset of the content to read; setting this to 42 will start reading at the 42nd byte index within the content block

      • length: number = 0

        the number of bytes to read after the offset

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Reads the next chunk of data for the content of this entry from the assigned source context.

      This is only applicable in async contexts, where the entry content is not already available via the content property.

      Returns Promise<null | Uint8Array<ArrayBufferLike>>

      The next byte array chunk if one exists, or null if there are no content bytes left (or the current source context is out of range of this entry)

    • Convenience for decoding the current content buffer as a string. Note that if the content was not loaded for whatever reason, this will return an empty string.

      Returns string

      The decoded string data from the currently assigned content, or an empty string if there is no content assigned.

    • Overridden to prevent circular reference errors / huge memory spikes that would include the underlying content by default.

      Returns Record<string, unknown>