Interface ZipDirectoryEntryExportOptions

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

interface ZipDirectoryEntryExportOptions {
    bufferedWrite?: boolean;
    creationDate?: Date;
    dataDescriptor?: boolean;
    dataDescriptorSignature?: boolean;
    encryptionStrength?: 1 | 2 | 3;
    extendedTimestamp?: boolean;
    externalFileAttribute?: number;
    internalFileAttribute?: number;
    keepOrder?: boolean;
    lastAccessDate?: Date;
    lastModDate?: Date;
    level?: number;
    mimeType?: string;
    msDosCompatible?: boolean;
    password?: string;
    preventClose?: boolean;
    rawPassword?: Uint8Array;
    readerOptions?: ZipReaderConstructorOptions;
    relativePath?: boolean;
    signal?: AbortSignal;
    supportZip64SplitFile?: boolean;
    usdz?: boolean;
    version?: number;
    versionMadeBy?: number;
    zip64?: boolean;
    zipCrypto?: boolean;
    encodeText?(text): Uint8Array;
    onend?(computedSize): Promise<void>;
    onprogress?(progress, total): Promise<void>;
    onstart?(total): Promise<void>;
}

Hierarchy (view full)

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.

Default Value

false
creationDate?: Date

The creation date.

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

Default Value

The current date.
dataDescriptor?: boolean

true to to add a data descriptor.

When set to false, the ZipWriterConstructorOptions#bufferedWrite option will automatically be set to true.

Default Value

true
dataDescriptorSignature?: boolean

true to add the signature of the data descriptor.

Default Value

false
encryptionStrength?: 1 | 2 | 3

The encryption strength (AES).

Default Value

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.

Default Value

true
externalFileAttribute?: number

The external file attribute.

Default Value

0
internalFileAttribute?: number

The internal file attribute.

Default Value

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.

Default Value

true
lastAccessDate?: Date

The last access date.

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

Default Value

The current date.
lastModDate?: Date

The last modification date.

Default Value

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.

Default Value

5
mimeType?: string

The MIME type of the exported data when relevant.

msDosCompatible?: boolean

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

Default Value

true
password?: string

The password used to encrypt the content of the entry.

preventClose?: boolean

true to prevent closing of WritableWriter#writable.

Default Value

false
rawPassword?: Uint8Array

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.

signal?: AbortSignal

The AbortSignal instance used to cancel the compression.

supportZip64SplitFile?: boolean

false to never write disk numbers in zip64 data.

Default Value

true
usdz?: boolean

trueto produce zip files compatible with the USDZ specification.

Default Value

false
version?: number

The "Version" field.

versionMadeBy?: number

The "Version made by" field.

Default Value

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

Default Value

false
zipCrypto?: boolean

true to use the ZipCrypto algorithm to encrypt the content of the entry.

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

Default Value

false

Methods

  • Encode the filename and the comment of the entry.

    Parameters

    • text: string

      The text to encode.

    Returns Uint8Array

    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>

    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>

    An empty promise or undefined.

  • The function called when starting compression/decompression.

    Parameters

    • total: number

      The total number of bytes.

    Returns Promise<void>

    An empty promise or undefined.