zip-fs.js is an optional script that helps to manipulate a zip file easily. It provides a virtual filesystem API implementation for zip files.
zip.fs.FS()
Zip filesystem constructor
A zip.fs.FS object stores an entire filesystem.
The root property stores a ZipDirectoryEntry object representing the root directory of the zip.
root (ZipDirectoryEntry)ZipDirectoryEntry object referencing the root directory of the filesystemFS.prototype.importBlob(blob, onend[, onerror])
Reset the filesystem and import a zipped content stored in a Blob object.
Parameters:
blob (Blob)Blob objectonend (Function)onerror (Function)FS.prototype.importData64URI(dataURI, onend[, onerror])
Reset the filesystem and import a zipped content stored in a data URI string.
Parameters:
dataURI (string)onend (Function)onerror (Function)FS.prototype.importHttpContent(URL, useRangeHeader, onend[, onerror])
Reset the filesystem and import a zipped content retrieved from a URL.
Parameters:
URL (string)useRangeHeader (boolean)onend (Function)onerror (Function)FS.prototype.exportBlob(onend[, onprogress, onerror])
Export zipped content from the filesystem in a Blob object.
Parameters:
onend (Function)onprogress (Function)(number) and a max value (number) as parametersonerror (Function)FS.prototype.exportData64URI(onend[, onprogress, onerror])
Export zipped content from the filesystem in a data URI.
Parameters:
onend (Function)onprogress (Function)(number) and a max value (number) as parametersonerror (Function)FS.prototype.exportFileEntry(fileEntry, onend[, onprogress, onerror])
Export zipped content from the filesystem in a FileEntry object.
Parameters:
fileEntry (FileEntry)FileEntry objectonend (Function)onprogress (Function)(number) and a max value (number) as parametersonerror (Function)FS.prototype.getById(entryId)
Get a ZipEntry object given a unique entry id.
Parameters:
entryId (number)FS.prototype.find(fullname)
Get a ZipEntry object given a unique entry full filename.
Parameters:
fullname (string)FS.prototype.remove(zipEntry)
Remove a ZipEntry object from the virtual filesystem.
Parameters:
zipEntry (ZipEntry)ZipEntry()
ZipEntry constructor
Each ZipEntry object represents a node in the zip directory tree.
A file in the zip is a ZipFileEntry with a ZipEntry object as prototype.
A directory in the zip is a ZipDirectoryEntry with a ZipEntry object as prototype.
name (string)directory (boolean)true if the entry is a ZipDirectoryEntry objectchildren (Array of ZipEntry)ZipFileEntry objectid (number)ZipEntry.prototype.getFileEntry(fileEntry, onend[, onprogress, onerror])
Store entry content into a FileEntry object.
Parameters:
fileEntry (FileEntry)FileEntry objectonend (Function)onprogress (Function)(number) and a max value (number) as parametersonerror (Function)ZipEntry.prototype.moveTo(directory)
Move this entry into the ZipDirectoryEntry target object.
Parameters:
directory (ZipDirectoryEntry)ZipDirectoryEntry target objectZipEntry.prototype.getFullname()
Get this entry full name.
Return
stringZipEntry.prototype.isDescendantOf(ancestor)
Test if this entry is a descendant of ancestor directory entry.
Parameters:
ancestor (ZipDirectoryEntry)Return
booleantrue if this entry is a descendant of ancestor directory entryZipFileEntry()
ZipFileEntry constructor
ZipFileEntry.prototype.getText(callback[, checkCrc32])
Get file entry content as a string.
Parameters:
callback (Function)checkCrc32 (boolean)true to verify data integrityZipFileEntry.prototype.getBlob(mimeType, callback[, checkCrc32])
Get file entry content as a Blob object.
Parameters:
mimeType (string)callback (Function)checkCrc32 (boolean)true to verify data integrityZipFileEntry.prototype.getData64URI(mimeType, callback[, checkCrc32])
Get file entry content as a data URI string.
Parameters:
mimeType (string)callback (Function)checkCrc32 (boolean)true to verify data integrityZipDirectoryEntry()
ZipDirectoryEntry constructor
ZipDirectoryEntry.prototype.addDirectory(name)
Add a directory into this directory entry.
Parameters:
name (string)Return
ZipDirectoryEntryZipDirectoryEntry objectZipDirectoryEntry.prototype.addBlob(name, blob)
Add a Blob object file into this directory entry.
Parameters:
name (string)Return
ZipFileEntryZipFileEntry objectZipDirectoryEntry.prototype.addText(name, text)
Add a text file into this directory entry.
Parameters:
name (string)text (string)Return
ZipFileEntryZipFileEntry objectZipDirectoryEntry.prototype.addData64URI(name, dataURI)
Add a data URI file into this directory entry.
Parameters:
name (string)text (string)Return
ZipFileEntryZipFileEntry objectZipDirectoryEntry.prototype.addHttpContent(name, URL, size, useRangeHeader)
Add a content retrieved from a URL into this directory entry.
Parameters:
name (string)URL (string)size (number)useRangeHeader (boolean)Return
ZipFileEntryZipFileEntry objectZipDirectoryEntry.prototype.addFileEntry(entry, callback[, onerror])
Add a FileEntry or a DirectoryEntry into this directory entry.
If entry is a FileEntry object then FileEntry.prototype.file() function is called in order to get its content.
If entry is a DirectoryEntry object then all its children (file or directory) will be added recursively into this directory entry.
Parameters:
entry (FileEntry or DirectoryEntry)callback (Function)onerror (Function)ZipDirectoryEntry.prototype.importBlob(blob, onend[, onerror])
Import a zipped content stored in a Blob object into this directory entry
Parameters:
blob (Blob)Blob objectonend (Function)onerror (Function)ZipDirectoryEntry.prototype.importData64URI(dataURI, onend[, onerror])
Import a zipped content stored in a data URI string into this directory entry.
Parameters:
dataURI (string)onend (Function)onerror (Function)ZipDirectoryEntry.prototype.importHttpContent(URL, useRangeHeader, onend[, onerror])
Import a zipped content retrieved from a URL into this directory entry.
Parameters:
URL (string)useRangeHeader (boolean)onend (Function)onerror (Function)ZipDirectoryEntry.prototype.exportBlob(onend[, onprogress, onerror])
Export zipped content in a Blob object from this directory entry.
Parameters:
onend (Function)onprogress (Function)(number) and a max value (number) as parametersonerror (Function)ZipDirectoryEntry.prototype.exportData64URI(onend[, onprogress, onerror])
Export zipped content in a data URI from this directory entry.
Parameters:
onend (Function)onprogress (Function)(number) and a max value (number) as parametersonerror (Function)ZipDirectoryEntry.prototype.exportFileEntry(fileEntry, onend[, onprogress, onerror])
Export zipped content in a FileEntry object from this directory entry.
Parameters:
fileEntry (FileEntry)FileEntry objectonend (Function)onprogress (Function)(number) and a max value (number) as parametersonerror (Function)ZipDirectoryEntry.prototype.getChildByName(name)
Get a ZipEntry child object given its filename.
Parameters:
name (string)Return