The children of the entry.
OptionaldataThe underlying EntryMetaData instance.
true for ZipDirectoryEntry instances.
The ID of the instance.
The relative filename of the entry.
Optional ReadonlyoptionsThe options applied to the entry when the zip file is exported.
These are the options passed when the entry was added to the filesystem, updated by ZipEntry#setOptions. An entry imported from a zip file has none until ZipEntry#setOptions is called.
OptionalparentThe parent directory of the entry.
The uncompressed size of the content.
It is the size of the raw compressed content when the entry has been imported with the
passThrough option set to true, since the entry holds the compressed data in that case. The
uncompressed size of the original entry remains available in ZipEntry#data.
Adds a entry entry with content provided as a Blob instance
The relative filename of the entry.
The Blob instance.
Optionaloptions: ZipWriterAddDataOptions
The options.
A ZipFileEntry instance.
Adds a entry entry with content provided as a Data URI string encoded in Base64
The relative filename of the entry.
The Data URI string encoded in Base64.
Optionaloptions: ZipWriterAddDataOptions
The options.
A ZipFileEntry instance.
Adds a directory
The relative filename of the directory.
Optionaloptions: ZipWriterAddDataOptions
The options.
A ZipDirectoryEntry instance.
Adds an entry with content provided via a File instance
The File instance.
Optionaloptions: ZipWriterAddDataOptions
The options.
A promise resolving to a ZipFileEntry or a ZipDirectoryEntry instance.
Adds an entry with content provided via a FileSystemEntry instance
The options apply to every entry added, including the directories. The
ZipWriterConstructorOptions#lastModDate option replaces the last modification date of the
files, which is otherwise taken from each FileSystemEntry instance.
The FileSystemEntry instance.
Optionaloptions: ZipWriterAddDataOptions
The options.
A promise resolving to an array of ZipFileEntry or a ZipDirectoryEntry instances.
Adds an entry with content provided via a FileSystemHandle instance
If a handle cannot be read, the original error is rethrown unmodified as an EntryError,
whose EntryError#entryName is the path of the handle that failed, relative to the parent
of fileSystemHandle.
The options apply to every entry added, including the directories. The
ZipWriterConstructorOptions#lastModDate option replaces the last modification date of the
files, which is otherwise taken from each FileSystemHandle instance.
The fileSystemHandle instance.
Optionaloptions: ZipWriterAddDataOptions
The options.
A promise resolving to an array of ZipFileEntry or a ZipDirectoryEntry instances.
Adds an entry with content fetched from a URL
The relative filename of the entry.
The URL.
Optionaloptions: HttpOptions & ZipWriterAddDataOptions
The options.
A ZipFileEntry instance.
Adds a entry entry with content provided via a ReadableStream instance
The relative filename of the entry.
The ReadableStream instance.
Optionaloptions: ZipWriterAddDataOptions
The options.
A ZipFileEntry instance.
Adds an entry with content provided as text
The relative filename of the entry.
The text.
Optionaloptions: ZipWriterAddDataOptions
The options.
A ZipFileEntry instance.
Adds an entry with content provided as a Uint8Array instance
The relative filename of the entry.
The Uint8Array instance.
Optionaloptions: ZipWriterAddDataOptions
The options.
A ZipFileEntry instance.
Tests the password on the entry and all children if any, returns true if the entry is not password protected
Optionaloptions: EntryGetDataOptionsClones the entry
OptionaldeepClone: boolean
true to clone all the descendants.
Returns a Blob instance containing a zip file of the entry and its descendants
Optionaloptions: ZipDirectoryEntryExportOptions
The options.
A promise resolving to the Blob instance.
Returns a Data URI string encoded in Base64 containing a zip file of the entry and its descendants
Optionaloptions: ZipDirectoryEntryExportOptions
The options.
A promise resolving to the Data URI string encoded in Base64.
Writes the entry and its descendants into a directory as files and sub-directories via the File System Access API (e.g. the Origin Private File System). Files are streamed and directories are merged into the target; colliding files are overwritten. This is the inverse of ZipDirectoryEntry#addFileSystemHandle.
If an entry cannot be written, the original error is rethrown unmodified as an EntryError, whose EntryError#entryName is the name of the entry that failed, relative to this entry.
The export is not atomic and nothing is rolled back, because the target is merged into rather than replaced: a file that already existed cannot be restored once overwritten. On failure the target is left as follows, and EntryError#exportedEntryNames lists the files that completed:
concurrent, every entry
cancelled alongside it;Running the same export again is the supported way to recover, since directories are merged and files are overwritten.
The target FileSystemDirectoryHandle instance.
Optionaloptions: ZipDirectoryEntryExportFileSystemHandleOptions
The options.
A promise resolving to the target FileSystemDirectoryHandle instance.
An entry flagged as a symbolic link by EntryMetaData#symlink is written as a regular file whose content is the path of the link target, because the File System Access API cannot create symbolic links.
Returns a Uint8Array instance containing a zip file of the entry and its descendants
Optionaloptions: ZipDirectoryEntryExportOptions
The options.
A promise resolving to the Uint8Array instance.
Creates a zip file via a WritableStream instance containing the entry and its descendants
Optionalwritable: WritableStream<any>
The WritableStream instance.
Optionaloptions: ZipDirectoryEntryExportOptions
The options.
A promise resolving to the Uint8Array instance.
Creates a zip file via a custom Writer instance containing the entry and its descendants
The Writer instance.
Optionaloptions: ZipDirectoryEntryExportOptions
The options.
A promise resolving to the data.
Gets a ZipEntry child instance from its relative filename
The relative filename.
A ZipFileEntry or a ZipDirectoryEntry instance (use the ZipFileEntry#directory and ZipDirectoryEntry#directory properties to differentiate entries).
Gets the children of the directory
Optionaloptions: ZipDirectoryEntryGetChildrenOptions
The options.
The array of ZipEntry instances.
The returned array is a snapshot taken when the method is called: entries added or removed afterwards are not reflected, and an entry removed while the array is being iterated is still present but detached from the filesystem.
With recursive, the descendants are ordered level by level, i.e. the children of a directory come
before the children of its subdirectories, like the result of readdir(path, { recursive: true }) in
Node.js. This is also the order in which {@link ZipDirectoryEntry}#export*() writes them.
Unlike ZipFS#entries, the directory itself is not included and removed entries leave no empty slot.
Computes the exact size in bytes of the zip file that export*() would produce for the entry
and its descendants, without reading or compressing any data.
Pass the same options object that will be passed to the export method, otherwise the result
will not match. The size is only determinable when every descendant is stored (i.e. level is
set to 0) or passed through, and has a known size; ERR_UNDETERMINED_SIZE is thrown
otherwise. Encryption does not prevent it, the overhead of ZipCrypto and AES being fixed.
The intended use is setting the Content-Length header of a zip file streamed over HTTP.
Optionaloptions: ZipDirectoryEntryExportOptions
The options.
A promise resolving to the size in bytes.
Entries added with ZipDirectoryEntry#addReadable never have a known size, and entries added with ZipDirectoryEntry#addHttpContent only get one once their content has been read. The returned size assumes a single output file, it does not apply to split zip files.
ERR_UNDETERMINED_SIZE is also thrown when the size depends on the order in which the
entries are physically written, which the buffered write path only determines at write time.
This happens when usdz is set, since the alignment padding depends on the offset of each
entry, and when the archive exceeds 4GB, since the offsets recorded in the central directory
are then extended to 64 bits. Passing bufferedWrite: false makes both determinable again,
as does exporting a directory whose children are all files. It is thrown as well when
signCentralDirectory is set, the length of the signature being unknown until it is computed.
ERR_UNDETERMINED_SIZE if the size cannot be determined.
Returns the full filename of the entry
Returns the filename of the entry relative to a parent directory
Extracts a zip file provided as a Blob instance into the entry
The Blob instance.
Optionaloptions: ZipReaderConstructorOptions
The options.
Use ZipDirectoryEntry#importZip with a ZipReader instance to read the data of the zip file itself, e.g. its ZipReader#prependedData or its ZipReader#comment property.
Extracts a zip file provided as a Data URI string encoded in Base64 into the entry
The Data URI string encoded in Base64.
Optionaloptions: ZipReaderConstructorOptions
The options.
Use ZipDirectoryEntry#importZip with a ZipReader instance to read the data of the zip file itself, e.g. its ZipReader#prependedData or its ZipReader#comment property.
Extracts a zip file fetched from a URL into the entry
The URL.
Optionaloptions: ZipDirectoryEntryImportHttpOptions
The options.
Use ZipDirectoryEntry#importZip with a ZipReader instance to read the data of the zip file itself, e.g. its ZipReader#prependedData or its ZipReader#comment property.
Extracts a zip file provided via a ReadableStream instance into the entry
The ReadableStream instance.
Optionaloptions: ZipReaderConstructorOptions
The options.
Use ZipDirectoryEntry#importZip with a ZipReader instance to read the data of the zip file itself, e.g. its ZipReader#prependedData or its ZipReader#comment property.
Extracts a zip file provided as a Uint8Array instance into the entry
The Uint8Array instance.
Optionaloptions: ZipReaderConstructorOptions
The options.
Use ZipDirectoryEntry#importZip with a ZipReader instance to read the data of the zip file itself, e.g. its ZipReader#prependedData or its ZipReader#comment property.
Optionaloptions: ZipReaderConstructorOptions
The options.
The filename of each entry is split into path components to build the tree of entries. Empty
components and "." components are ignored, so "a//b.txt", "./a/b.txt" and "a/./b.txt" all produce
the same "a/b.txt" entry. Filenames are normalized and validated beforehand, see
GetEntriesOptions#normalizeFilename and GetEntriesOptions#filenameValidation.
The directories created that way are navigable like any other entry but are not written back when the tree is exported: only the directories carried by the source zip file and the ones created with ZipDirectoryEntry#addDirectory are written. A zip file storing no directory entry therefore round-trips to a zip file storing no directory entry, instead of gaining one entry per path component.
Passing a ZipReader instance is the way to read the data of the zip file itself, e.g. its
ZipReader#prependedData or its ZipReader#comment property, since the instance created
otherwise is not exposed. Its options are used as defaults for the options passed here, and it must not
have read its entries yet when it is created over a ReadableStream instance, which can only be read once.
Tests if a ZipDirectoryEntry instance is an ancestor of the entry
The ZipDirectoryEntry instance.
Tests if the entry or any of its children is password protected
Set the name of the entry
The new name of the entry.
Sets the options applied to the entry when the zip file is exported
The options.
The options are merged into ZipEntry#options, and an option set to undefined is removed
from it instead of being stored. They take precedence over the options passed to
{@link ZipDirectoryEntry}#export*() and over the metadata of the entry they were imported from,
exactly like the options passed when adding an entry to the filesystem.
The options describing the data of an entry exported as-is, e.g. ZipWriterConstructorOptions#compressionMethod and ZipWriterAddDataOptions#uncompressedSize, are ignored: they are always the ones of the original entry. The ZipWriterAddDataOptions#directory option and the progress callbacks are ignored as well. Invalid option values are reported when the zip file is exported.
Represents a directory entry in the zip (Filesystem API).