|
> readZip("pnuts.jar") 0 Fri May 05 18:30:30 JST 2000 pnuts/ 0 Fri May 05 18:30:30 JST 2000 pnuts/awt/ 2869 Tue May 30 16:08:32 JST 2000 pnuts/awt/DialogOutputStream.class 4980 Fri May 05 18:30:30 JST 2000 pnuts/awt/Layout.class ....
When entryHandler is a function with two parameters, the function is called with a ZipEntry object that represents each entry of the ZIP file and ZipInputStream object from which the content of the entry is read.
entryHandler(ZipEntry entry, ZipInputStream in)
For instance, the following function writes the content of a file in a ZIP file to the specified OutputStream.
function extract(zipfile, name, out){ readZip(zipfile, function (e, in) if (e.getName() == name) read(in, out)) }
|
writeZip() creates a ZIP file from fileList and writes to the specified file or outputStream. When a directory is in fileList, files in the directory are added to the ZIP file recursively.
updateZip() replaces the specified entry ( entryName ) of the ZIP file ( zipfile ) with the specified file (fileName or file) or InputStream (inputStream). If entryName is not specified fileName or file.getName() is used instead.
If the 3rd parameter is null, the ZIP entry is deleted from the ZIP file. When the 3rd parameter is non-null and the entryName is not in the ZIP file, new ZIP entry is added.