@zip.js/zip.js
    Preparing search index...

    Interface FileEntry

    Represents the metadata of an entry in a zip file (Core API).

    interface FileEntry {
        bitFlag?: EntryBitFlag;
        comment: string;
        commentUTF8: boolean;
        compressedSize: number;
        compressionMethod: number;
        crc32?: number;
        creationDate?: Date;
        directory: false;
        diskNumberStart: number;
        encrypted: boolean;
        executable: boolean;
        externalFileAttribute: number;
        externalFileAttributes: number;
        extraField?: Map<number, { data: Uint8Array; type: number }>;
        extraFieldAES?: EntryExtraFieldAES;
        extraFieldExtendedTimestamp?: EntryExtraFieldExtendedTimestamp;
        extraFieldInfoZip?: EntryExtraFieldUnix;
        extraFieldLength?: number;
        extraFieldNTFS?: EntryExtraFieldNTFS;
        extraFieldPkwareUnix?: EntryExtraFieldUnixDates;
        extraFieldUnicodeComment?: EntryExtraFieldUnicode;
        extraFieldUnicodePath?: EntryExtraFieldUnicode;
        extraFieldUnix?: EntryExtraFieldUnix;
        extraFieldUnixType1?: EntryExtraFieldUnixDates;
        extraFieldUSDZ?: EntryExtraField;
        extraFieldZip64?: EntryExtraFieldZip64;
        filename: string;
        filenameLength?: number;
        filenameUTF8: boolean;
        gid?: number;
        internalFileAttribute: number;
        internalFileAttributes: number;
        lastAccessDate?: Date;
        lastModDate: Date;
        localDirectory?: LocalDirectory;
        msdosAttributes?: {
            archive: boolean;
            directory: boolean;
            hidden: boolean;
            readOnly: boolean;
            system: boolean;
        };
        msdosAttributesRaw?: number;
        msDosCompatible: boolean;
        offset: number;
        rawBitFlag?: number;
        rawComment: Uint8Array;
        rawCreationDate?: number
        | bigint;
        rawExtraField: Uint8Array;
        rawFilename: Uint8Array;
        rawLastAccessDate?: number | bigint;
        rawLastModDate: number | bigint;
        setgid?: boolean;
        setuid?: boolean;
        signature?: number;
        sticky?: boolean;
        symlink: boolean;
        uid?: number;
        uncompressedSize: number;
        unixExternalUpper?: number;
        unixMode?: number;
        version: number;
        versionMadeBy: number;
        zip64: boolean;
        zipCrypto: boolean;
        arrayBuffer(options?: EntryGetDataOptions): Promise<ArrayBuffer>;
        getData<Type>(
            writer:
                | WritableStream<any>
                | WritableWriter
                | AsyncGenerator<
                    WritableStream<any>
                    | WritableWriter
                    | Writer<unknown>,
                    boolean,
                    any,
                >
                | Writer<Type>,
            options?: EntryGetDataCheckPasswordOptions,
        ): Promise<Type>;
    }

    Hierarchy (View Summary)

    Index
    bitFlag?: EntryBitFlag

    The general purpose bit flag.

    comment: string

    The comment of the entry.

    commentUTF8: boolean

    true if the comment is encoded in UTF-8.

    compressedSize: number

    The size of the compressed data in bytes.

    compressionMethod: number

    The compression method.

    crc32?: number

    The CRC-32 checksum of the content. It is undefined when the zip file does not store it, e.g. for entries encrypted with AES in AE-2 format.

    creationDate?: Date

    The creation date.

    directory: false

    false if the entry is a file.

    diskNumberStart: number

    The number of the disk where the entry data starts.

    encrypted: boolean

    true if the content of the entry is encrypted.

    executable: boolean

    true if the entry is an executable file

    Always false when EntryMetaData#symlink is true: the permissions of a symbolic link are not meaningful, Unix systems store them as 0o777.

    externalFileAttribute: number

    The external file attribute (raw).

    Use EntryMetaData#externalFileAttributes instead.

    externalFileAttributes: number

    The 32-bit externalFileAttributes field is the authoritative on-disk metadata for each entry.

    • Upper 16 bits: Unix mode/type (e.g., permissions, file type)
    • Low 8 bits: MS-DOS file attributes (e.g., directory, read-only)

    When writing, all provided options are merged into this field. When reading, convenience fields are decoded from it. For most use cases, prefer the high-level options and fields; only advanced users need to manipulate the raw value directly.

    extraField?: Map<number, { data: Uint8Array; type: number }>

    The extra field.

    extraFieldAES?: EntryExtraFieldAES

    The AES extra field.

    extraFieldExtendedTimestamp?: EntryExtraFieldExtendedTimestamp

    The extended timestamp extra field.

    extraFieldInfoZip?: EntryExtraFieldUnix

    The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It is read whenever the type 2 extra field (0x7855) is absent or carries no ids, which is its usual state in the central directory.

    extraFieldLength?: number

    The length of the extra field in bytes.

    extraFieldNTFS?: EntryExtraFieldNTFS

    The NTFS extra field.

    extraFieldPkwareUnix?: EntryExtraFieldUnixDates

    The PKWARE Unix extra field (0x000d).

    extraFieldUnicodeComment?: EntryExtraFieldUnicode

    The Unicode comment extra field.

    extraFieldUnicodePath?: EntryExtraFieldUnicode

    The Unicode path extra field.

    extraFieldUnix?: EntryExtraFieldUnix

    The Info-ZIP Unix type 2 extra field (0x7855). Its uid/gid are stored in the local file header only, the central directory version carries no data and merely flags their presence.

    extraFieldUnixType1?: EntryExtraFieldUnixDates

    The Info-ZIP Unix type 1 extra field (0x5855).

    extraFieldUSDZ?: EntryExtraField

    The USDZ extra field.

    extraFieldZip64?: EntryExtraFieldZip64

    The Zip64 extra field.

    filename: string

    The filename of the entry.

    filenameLength?: number

    The length of the filename in bytes.

    filenameUTF8: boolean

    true if the filename is encoded in UTF-8.

    gid?: number

    Unix group id when available.

    See EntryMetaData#uid for the fields storing the ids in the local file header only.

    internalFileAttribute: number

    The internal file attribute (raw).

    Use EntryMetaData#internalFileAttributes instead.

    internalFileAttributes: number

    The internal file attributes (raw).

    lastAccessDate?: Date

    The last access date.

    lastModDate: Date

    The last modification date.

    localDirectory?: LocalDirectory

    The local file header fields, set when the entry data has been read.

    The local file header is the only place where the Info-ZIP Unix extra fields type 1 (0x5855) and type 2 (0x7855) store the uid/gid, so this is where they are read for entries carrying just these fields, e.g. with entry.localDirectory.extraFieldUnixType1.uid. The values are not merged into EntryMetaData#uid and EntryMetaData#gid, which are read from the central directory.

    msdosAttributes?: {
        archive: boolean;
        directory: boolean;
        hidden: boolean;
        readOnly: boolean;
        system: boolean;
    }

    The MS-DOS attribute flags exposed as booleans.

    msdosAttributesRaw?: number

    The MS-DOS attributes low byte (raw). This is the low 8 bits of EntryMetaData#externalFileAttributes when present.

    msDosCompatible: boolean

    true if internalFileAttributes and externalFileAttributes are compatible with MS-DOS format.

    offset: number

    The byte offset of the entry.

    rawBitFlag?: number

    The general purpose bit flag (raw).

    rawComment: Uint8Array

    The comment of the entry (raw).

    rawCreationDate?: number | bigint

    The creation date (raw), as the Windows FILETIME value stored in the NTFS extra field. Only defined when that extra field is present.

    rawExtraField: Uint8Array

    The extra field (raw).

    rawFilename: Uint8Array

    The filename of the entry (raw).

    rawLastAccessDate?: number | bigint

    The last access date (raw), as the Windows FILETIME value stored in the NTFS extra field. Only defined when that extra field is present.

    rawLastModDate: number | bigint

    The last modification date (raw), as the MS-DOS date and time stored in the header. Unlike EntryMetaData#lastModDate, it is not replaced by the value of the NTFS extra field when that field is present; read EntryMetaData#extraFieldNTFS for the raw NTFS value.

    setgid?: boolean

    true if the setgid bit is set on the entry.

    setuid?: boolean

    true if the setuid bit is set on the entry.

    signature?: number

    The signature (CRC32 checksum) of the content. It is undefined for entries encrypted with AES returned by ZipWriter#add.

    Use EntryMetaData#crc32 instead.

    sticky?: boolean

    true if the sticky bit is set on the entry.

    symlink: boolean

    true if the entry is a symbolic link, i.e. if the Unix file type stored in EntryMetaData#externalFileAttributes is S_IFLNK (0o120000).

    The target of the link is the content of the entry, stored as a path with no trailing NUL character. It is read like any other entry, e.g. with entry.getData(new TextWriter()).

    The path is not validated: it can be absolute or escape the archive with .. segments. It must be checked before being used to resolve a file.

    There is no option to write a symbolic link. Set the file type in ZipWriterConstructorOptions#unixMode instead, i.e. pass 0o120777 with the path of the target as the content of the entry.

    uid?: number

    Unix owner id when available.

    The value is read from the central directory. The Info-ZIP Unix extra fields type 1 (0x5855) and type 2 (0x7855) store the ids in the local file header only, so entries carrying just these fields leave the property undefined until the data has been read, at which point it is filled in from EntryMetaData#localDirectory. The Info-ZIP New Unix extra field (0x7875) and the PKWARE Unix extra field (0x000d) store the ids in both headers and are unaffected.

    A value read from the central directory is never overwritten by the local file header, since the type 2 field truncates the ids to 16 bits while the New Unix field does not.

    uncompressedSize: number

    The size of the decompressed data in bytes.

    unixExternalUpper?: number

    The upper 16-bit portion of EntryMetaData#externalFileAttributes when it represents Unix mode bits.

    unixMode?: number

    Unix mode (st_mode) when available.

    version: number

    The "Version" field.

    versionMadeBy: number

    The "Version made by" field.

    zip64: boolean

    true if the entry is using Zip64.

    zipCrypto: boolean

    true if the content of the entry is encrypted with the ZipCrypto algorithm.

    • Retrieves the content of the entry as an ArrayBuffer instance

      Parameters

      Returns Promise<ArrayBuffer>

      A promise resolving to an ArrayBuffer instance.

    • Returns the content of the entry

      Type Parameters

      • Type

      Parameters

      Returns Promise<Type>

      A promise resolving to the type to data associated to writer.