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

Hierarchy

  • TarEntry

Implements

Constructors

Properties

mContent: null | Uint8Array
mContext: null | ArchiveContext
mHeader: TarHeader
mOffset: number

Accessors

  • get bufferEndIndex(): number
  • The ending absolute index (exclusive) in the source buffer that this entry was parsed from. Returns sectorByteLength by default if this was not parsed by a source buffer.

    Returns number

  • get bufferStartIndex(): 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

  • get byteLength(): number
  • The total exact byte length of this entry, including the header.

    Returns number

  • get content(): undefined | null | Uint8Array
  • 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

  • get contentEndIndex(): number
  • The ending index (exclusive) of the content of this entry. If this entry is not a file, or the file is empty, this will be the same as the content starting index.

    Returns number

  • get contentStartIndex(): number
  • The starting index (inclusive) of the content of this entry. Note that this will always be the first index of the header, regardless of whether or not this is a file.

    Returns number

  • get context(): undefined | null | ArchiveContext
  • The context (if any) from which this entry was parsed. The context will include global data about things such as the origin of the archive and global pax headers.

    Returns undefined | null | ArchiveContext

  • get sectorByteLength(): number
  • The total byte length of this entry, including the header, which is a multiple of the standard tar sector size.

    Returns number

Methods

  • 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

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

    Returns string

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

    Parameters

    Returns Promise<Uint8Array>

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

    Returns Record<string, unknown>

  • Writes the header and content of this entry to the given output

    Returns

    true if this entry was successfully written to the output

    Parameters

    • output: Uint8Array

      the buffer to be written to

    • offset: number

      the offset in the buffer to start writing entry data

    Returns boolean

Generated using TypeDoc