Module

x/zipjs/index.js>ZipWriterConstructorOptions

JavaScript library to zip and unzip files supporting multi-core compression, compression streams, zip64, split files and encryption.
Latest
interface ZipWriterConstructorOptions
import { type ZipWriterConstructorOptions } from "https://dotland.deno.dev/x/zipjs@v2.7.53/index.js";

Represents options passed to the constructor of ZipWriter, {@link ZipWriter#add} and [ZipDirectoryEntry](https://dotland.deno.dev/x/zipjs@v2.7.53/index.js?s=ZipDirectoryEntry)#export*.

Properties

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

optional
preventClose: boolean

true to prevent closing of {@link WritableWriter#writable}.

optional
level: number

The level of compression.

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

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

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

optional
password: string

The password used to encrypt the content of the entry.

optional
rawPassword: Uint8Array

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

optional
encryptionStrength: 1 | 2 | 3

The encryption strength (AES).

optional
signal: AbortSignal

The AbortSignal instance used to cancel the compression.

optional
lastModDate: Date

The last modification date.

optional
lastAccessDate: Date

The last access date.

This option is ignored if the {@link ZipWriterConstructorOptions#extendedTimestamp} option is set to false.

optional
creationDate: Date

The creation date.

This option is ignored if the {@link ZipWriterConstructorOptions#extendedTimestamp} option is set to false.

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

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

optional
version: number

The "Version" field.

optional
versionMadeBy: number

The "Version made by" field.

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

optional
dataDescriptor: boolean

true to add a data descriptor.

When set to false, the {@link ZipWriterConstructorOptions#bufferedWrite} option will automatically be set to true.

optional
dataDescriptorSignature: boolean

true to add the signature of the data descriptor.

optional
msDosCompatible: boolean

true to write {@link EntryMetaData#externalFileAttribute} in MS-DOS format for folder entries.

optional
externalFileAttribute: number

The external file attribute.

optional
internalFileAttribute: number

The internal file attribute.

optional
supportZip64SplitFile: boolean

false to never write disk numbers in zip64 data.

optional
usdz: boolean

trueto produce zip files compatible with the USDZ specification.

optional
passThrough: boolean

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

optional
encrypted: boolean

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

optional
offset: number

The offset of the first entry in the zip file.

optional
compressionMethod: number

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

Methods

optional
encodeText(text: string): Uint8Array | undefined

Encode the filename and the comment of the entry.