tar
    Preparing search index...

    Class Unpack

    Extracts the entries of an archive with async file system functions.

    Several entries are extracted at one time. Entries that use the same path, or a path and a directory above it, are extracted in the order of the archive.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    chmod: boolean
    cwd: string

    The absolute path of the extraction directory.

    dirname: (path: string) => string

    The parent directory of an absolute path.

    dmode: number
    fatal?: { error: unknown }

    Set when an error stops the extraction.

    fmode: number
    forceChown: boolean
    gid?: number
    keep: boolean
    maxDepth: number
    newer: boolean
    noMtime: boolean

    The options, with no prototype.

    preserveOwner: boolean
    preservePaths: boolean
    processGid?: number
    processUid?: number
    processUmask: number
    resolve: (base: string, path: string) => string

    Resolve a path from an absolute path.

    strip: number
    uid?: number
    umask: number
    unlink: boolean
    win32: boolean
    writeFlag: (size: number) => string | number

    Gives the open flag for a new file of a given size.

    Methods

    • Check the entry, with no use of the file system. Set its absolute path, and change its path, linkpath, and mode to the values to extract. False if the entry must not be extracted.

      Parameters

      Returns boolean

    • Report the failure of one entry as a TAR_ENTRY_ERROR warning. Throws the error if it stops the extraction: the extraction directory is not usable, the archive cannot be read, or strict is set.

      Parameters

      Returns void

    • Extract the archive. The promise settles when all the file system work is done. It rejects with the first error that stops the extraction.

      Parameters

      Returns Promise<void>

    • Record the error that stops the extraction. Returns it.

      Parameters

      • error: unknown

      Returns unknown

    • The parts of the path from the extraction directory to the target of a link entry. None of them can be a symbolic link.

      Parameters

      Returns string[]

    • The owner to set on the entry, if it needs one: with preserveOwner, when the owner in the archive is not the process owner, and with uid and gid, when they are not the process owner.

      Parameters

      Returns { gid: number; uid: number } | undefined

    • The parts of the path from the extraction directory to the parent directory of an entry. The extraction checks them again after it makes the entry: none of them can be a symbolic link then. So a directory that another process replaced with a symbolic link during the extraction is an error of the entry.

      Parameters

      • absolute: string

      Returns string[]

    • The paths that the entry must have for itself while it is made. A link also reserves its target, so that an entry that makes the target, and an entry that goes through the link, do not run at the same time as the link.

      Parameters

      Returns string[]

    • Report a problem to onwarn, or throw it if strict is set. A damaged archive is always an error here, because the extraction cannot be complete.

      Parameters

      • code: string
      • message: string | Error
      • data: WarnData = {}

      Returns void