tar
    Preparing search index...

    Class Pack

    Makes an archive. add() paths and entries, then end(). The pack is the async iterator of the bytes of the archive, compressed if an option selects a codec.

    It reads the file system only when the consumer asks for bytes. Then it reads the first jobs paths of the queue at the same time, and writes them in the order of the queue. The entries of a directory go to the end of the queue.

    return() closes each file that is open.

    Hierarchy (View Summary)

    Implements

    • AsyncIterableIterator<Uint8Array, undefined>
    Index

    Constructors

    Properties

    codec?: Codec

    The compression of the output.

    codecOptions?: Record<string, unknown>
    cwd?: string

    The normalized form of opt.cwd.

    ended: boolean = false

    True after end().

    head?: QueueNode<
        | ReadEntry
        | WriteEntry
        | PackJob
        | AsyncIterable<ReadEntry | WriteEntry, any, any>
        | Iterable<ReadEntry | WriteEntry, any, any>,
    >

    The options of WriteEntry.encode.

    jobs: number
    maxReadSize: number
    tail?: QueueNode<
        | ReadEntry
        | WriteEntry
        | PackJob
        | AsyncIterable<ReadEntry | WriteEntry, any, any>
        | Iterable<ReadEntry | WriteEntry, any, any>,
    >
    wake?: () => void
    win32: boolean

    Methods

    • Returns this

    • Add no more. The archive ends after the last item of the queue.

      Returns this

    • Report a path that does not exist, and skip it. Each other error of the stat is thrown.

      Parameters

      Returns undefined

    • True if the pack must read the exact dev and ino of the object with the bigint option: the numbers are not exact, and a wrong match loses data. That is a file with more than one link, which a wrong match makes a hard link to a different file, and with follow a directory, which a wrong match skips as a directory in itself. Each other object gets no second stat.

      Parameters

      Returns boolean

    • Returns Promise<IteratorResult<Uint8Array<ArrayBufferLike>, undefined>>

    • Make the entry for a path.

      Parameters

      • job: PackJob
      • stat: CreateStats
      • type: EntryTypeName
      • linkpath: string | undefined
      • body:
            | Blob
            | Uint8Array<ArrayBufferLike>
            | ReadableStream<Uint8Array<ArrayBufferLike>>
            | AsyncIterable<Uint8Array<ArrayBufferLike>, any, any>
            | Iterable<Uint8Array<ArrayBufferLike>, any, any>
            | undefined

      Returns WriteEntry

    • The absolute form of a path that is relative to cwd.

      Parameters

      • path: string

      Returns string

    • Stop, and close each file that is open.

      Returns Promise<IteratorResult<Uint8Array<ArrayBufferLike>, undefined>>