tar
    Preparing search index...

    Class PackBase<FS, E, S>Abstract

    The parts of Pack and PackSync that are the same: the options, the queue, and the rules that make an entry from a path or from an entry of another archive.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    • Type Parameters

      Parameters

      • opt: WarnOptions & {
            brotli?: boolean | Record<string, unknown>;
            codecs?: Codec[];
            compress?: Codec | [codec: Codec, options: Record<string, unknown>];
            cwd?: string;
            filter?: (path: string, entry: CreateStats | E) => boolean;
            follow?: boolean;
            gzip?: boolean | Record<string, unknown>;
            maxReadSize?: number;
            mtime?: Date;
            noDirRecurse?: boolean;
            noMtime?: boolean;
            noPax?: boolean;
            onWriteEntry?: (entry: WriteEntry) => unknown;
            platform?: "win32" | "posix";
            portable?: boolean;
            prefix?: string;
            preservePaths?: boolean;
            processUid?: number;
            processUname?: string;
            zstd?: boolean | Record<string, unknown>;
        } & { fs?: FS }
        • Optionalbrotli?: boolean | Record<string, unknown>

          Compress with the codec named brotli in codecs.

        • Optionalcodecs?: Codec[]

          Compression formats, before the gzip support of the runtime. The options gzip, brotli, and zstd select the first codec that has that name.

        • Optionalcompress?: Codec | [codec: Codec, options: Record<string, unknown>]

          Compress with this codec. It does not need to be in codecs. With a pair, the second item is given to the compress function of the codec.

        • Optionalcwd?: string

          The absolute path of the directory that the paths to add are relative to. A pack needs it, and fs, to add a path. A path that is not absolute is a TypeError.

        • Optionalfilter?: (path: string, entry: CreateStats | E) => boolean

          Called with each path and its lstat result (its stat result with follow), and with each entry of another archive. If it returns false, the path or the entry is not added.

        • Optionalfollow?: boolean

          Add the target of a symbolic link, not the link.

        • Optionalgzip?: boolean | Record<string, unknown>

          Compress with the codec named gzip.

        • OptionalmaxReadSize?: number

          The most bytes to read from a file at one time. Default, and with 0, 16 MiB. A positive integer, or Infinity. A larger file is not read before the pack comes to it.

        • Optionalmtime?: Date

          The mtime of each entry.

        • OptionalnoDirRecurse?: boolean

          Add a directory without the entries in it.

        • OptionalnoMtime?: boolean

          Write no mtime.

        • OptionalnoPax?: boolean

          Write no PAX header for a field that does not fit the header.

        • OptionalonWriteEntry?: (entry: WriteEntry) => unknown

          Called with each entry before its header is written. It can change the fields of the entry.

        • Optionalplatform?: "win32" | "posix"

          With 'win32', each \ in a path is changed to /, and the characters that winchars encodes are decoded.

        • Optionalportable?: boolean

          Leave out the data that is specific to one system: uid, gid, uname, gname, atime, ctime, dev, ino, nlink, and the mtime of a directory. Remove the write permission of the group and of others.

        • Optionalprefix?: string

          A directory to put before the path of each entry.

        • OptionalpreservePaths?: boolean

          Keep a root at the start of a path, such as /.

        • OptionalprocessUid?: number

          The user ID of the process.

        • OptionalprocessUname?: string

          The uname of each file that processUid owns.

        • Optionalzstd?: boolean | Record<string, unknown>

          Compress with the codec named zstd in codecs.

        • Optionalfs?: FS
      • compress: "compress" | "compressSync"

      Returns PackBase<FS, E, S>

    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().

    fs?: FS

    The options of WriteEntry.encode.

    maxReadSize: number
    wake?: () => void
    win32: boolean

    Methods

    • Put a path, an entry, or a source of entries at the end of the queue. A directory is added with all that is in it.

      Parameters

      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

    • 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