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

    Interface ZipDirectoryEntryExportOptions

    Represents the options passed to {@link ZipDirectoryEntry}#export*().

    interface ZipDirectoryEntryExportOptions {
        bufferedWrite?: boolean;
        compressionMethod?: number;
        creationDate?: Date;
        dataDescriptor?: boolean;
        dataDescriptorSignature?: boolean;
        encrypted?: boolean;
        encryptionStrength?: 2 | 1 | 3;
        extendedTimestamp?: boolean;
        externalFileAttributes?: number;
        gid?: number;
        internalFileAttributes?: number;
        keepOrder?: boolean;
        lastAccessDate?: Date;
        lastModDate?: Date;
        level?: number;
        mimeType?: string;
        msdosAttributes?: {
            archive?: boolean;
            directory?: boolean;
            hidden?: boolean;
            readOnly?: boolean;
            system?: boolean;
        };
        msdosAttributesRaw?: number;
        msDosCompatible?: boolean;
        offset?: number;
        passThrough?: boolean;
        password?: string;
        preventClose?: boolean;
        rawPassword?: Uint8Array<ArrayBufferLike>;
        readerOptions?: ZipReaderConstructorOptions;
        relativePath?: boolean;
        setgid?: boolean;
        setuid?: boolean;
        signal?: AbortSignal;
        sticky?: boolean;
        supportZip64SplitFile?: boolean;
        uid?: number;
        unixExtraFieldType?: "infozip" | "unix";
        unixMode?: number;
        usdz?: boolean;
        useUnicodeFileNames?: boolean;
        version?: number;
        versionMadeBy?: number;
        zip64?: boolean;
        zipCrypto?: boolean;
        encodeText?(text: string): Uint8Array<ArrayBufferLike> | undefined;
        onend?(computedSize: number): Promise<void> | undefined;
        onprogress?(progress: number, total: number): Promise<void> | undefined;
        onstart?(total: number): Promise<void> | undefined;
    }

    Hierarchy (View Summary)

    Index

    Properties

    bufferedWrite?: boolean

    true to write entry data in a buffer before appending it to the zip file.

    bufferedWrite is automatically set to true when compressing more than one entry in parallel.

    false
    
    compressionMethod?: number

    The compression method (e.g. 8 for DEFLATE, 0 for STORE).

    creationDate?: Date

    The creation date.

    This option is ignored if the ZipWriterConstructorOptions#extendedTimestamp option is set to false.

    The current date.
    
    dataDescriptor?: boolean

    true to add a data descriptor.

    When set to false, the ZipWriterConstructorOptions#bufferedWrite option will automatically be set to true. It will be automatically set to false when it is undefined and the ZipWriterConstructorOptions#bufferedWrite option is set to true, or when the {@link ZipWriterConstructorOptions#zipCrypto} option is set totrue. Otherwise, the default value is true`.

    dataDescriptorSignature?: boolean

    true to add the signature of the data descriptor.

    false
    
    encrypted?: boolean

    true to write encrypted data when passThrough is set to true.

    encryptionStrength?: 2 | 1 | 3

    The encryption strength (AES):

    • 1: 128-bit encryption key
    • 2: 192-bit encryption key
    • 3: 256-bit encryption key
    3
    
    extendedTimestamp?: boolean

    true to store extended timestamp extra fields.

    When set to false, the maximum last modification date cannot exceed November 31, 2107 and the maximum accuracy is 2 seconds.

    true
    
    externalFileAttributes?: number

    The external file attribute.

    0
    
    gid?: number

    The Unix group id to write in the Unix extra field or as part of the external attributes.

    internalFileAttributes?: number

    The internal file attribute.

    0
    
    keepOrder?: boolean

    true to keep the order of the entry physically in the zip file.

    When set to true, the use of web workers will be improved. However, it also prevents files larger than 4GB from being created without setting the zip64 option to true explicitly. Another solution to improve the use of web workers is to add entries from smallest to largest in uncompressed size.

    true
    
    lastAccessDate?: Date

    The last access date.

    This option is ignored if the ZipWriterConstructorOptions#extendedTimestamp option is set to false.

    The current date.
    
    lastModDate?: Date

    The last modification date.

    The current date.
    
    level?: number

    The level of compression.

    The minimum value is 0 and means that no compression is applied. The maximum value is 9.

    6
    
    mimeType?: string

    The MIME type of the exported data when relevant.

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

    When provided, MS-DOS attribute flags (boolean object) to write into external file attributes low byte.

    msdosAttributesRaw?: number

    When provided, the low 8-bit MS-DOS attributes to write into external file attributes. Must be an integer between 0 and 255.

    msDosCompatible?: boolean

    true to write EntryMetaData#externalFileAttributes in MS-DOS format for folder entries.

    false
    
    offset?: number

    The offset of the first entry in the zip file.

    passThrough?: boolean

    true to write the data as-is without compressing it and without crypting it.

    password?: string

    The password used to encrypt the content of the entry.

    preventClose?: boolean

    true to prevent closing of WritableWriter#writable.

    false
    
    rawPassword?: Uint8Array<ArrayBufferLike>

    The password used to encrypt the content of the entry (raw).

    The options passed to the Reader instances

    relativePath?: boolean

    true to use filenames relative to the entry instead of full filenames.

    setgid?: boolean

    true to set the setgid bit when writing the Unix mode.

    setuid?: boolean

    true to set the setuid bit when writing the Unix mode.

    signal?: AbortSignal

    The AbortSignal instance used to cancel the compression.

    sticky?: boolean

    true to set the sticky bit when writing the Unix mode.

    supportZip64SplitFile?: boolean

    false to never write disk numbers in zip64 data.

    true
    
    uid?: number

    The Unix owner id to write in the Unix extra field or as part of the external attributes.

    unixExtraFieldType?: "infozip" | "unix"

    Which Unix extra field format to write when creating entries that include Unix metadata.

    • "infozip": use Info-ZIP New Unix extra field
    • "unix": use the traditional Unix extra field format
    unixMode?: number

    The Unix mode (st_mode bits) to use when writing external attributes.

    usdz?: boolean

    trueto produce zip files compatible with the USDZ specification.

    false
    
    useUnicodeFileNames?: boolean

    true to mark the file names as UTF-8 setting the general purpose bit 11 in the header (see Appendix D - Language Encoding (EFS)), false to mark the names as compliant with the original IBM Code Page 437.

    Note that this does not ensure that the file names are in the correct encoding.

    true
    
    version?: number

    The "Version" field.

    versionMadeBy?: number

    The "Version made by" field.

    20
    
    zip64?: boolean

    true to use Zip64 to store the entry.

    zip64 is automatically set to true when necessary (e.g. compressed data larger than 4GB or with unknown size).

    false
    
    zipCrypto?: boolean

    true to use the ZipCrypto algorithm to encrypt the content of the entry. Setting it to true will also set the ZipWriterConstructorOptions#dataDescriptor to true.

    It is not recommended to set zipCrypto to true because the ZipCrypto encryption can be easily broken.

    false
    

    Methods

    • The function called for encoding the filename and the comment of the entry.

      Parameters

      • text: string

        The text to encode.

      Returns Uint8Array<ArrayBufferLike> | undefined

      The encoded text or undefined if the text should be encoded by zip.js.

    • The function called when ending compression/decompression.

      Parameters

      • computedSize: number

        The total number of bytes (computed).

      Returns Promise<void> | undefined

      An empty promise or undefined.

    • The function called during compression/decompression.

      Parameters

      • progress: number

        The current progress in bytes.

      • total: number

        The total number of bytes.

      Returns Promise<void> | undefined

      An empty promise or undefined.

    • The function called when starting compression/decompression.

      Parameters

      • total: number

        The total number of bytes.

      Returns Promise<void> | undefined

      An empty promise or undefined.