Zip new - Axiom

The axiom.Zip library is used to read/add to Zip files. It can be instantiated as follows:

var zip = new axiom.Zip(file)

In this case, file is either an axiom.SystemFile object, an instance of java.io.File, or the string path to the Zip file.

Below are the properties and methods available.

Contents

axiom.Zip.add()

Description

axiom.Zip.add(file, level, prefix)

Adds a single file or directory tree to the zip archive.

Parameters

  • file (SystemFile or String) - SystemFile object or path to a file/directory on disk to be added.
  • level (Number, Optional) - Compression level 0-9, with 9 being the best compression. The default is 9.
  • prefex (String, Optional) - Path prefix to use.


axiom.Zip.addData(data, name, level)

Description

axiom.Zip.addData(data, name, level)

Parameters

  • data (ByteArray) - Java ByteArray containing the data to add to the archive.
  • name (String) - Name of the file, optionally containing a path prefix.
  • level (Number) - Compression level 0-9, with 9 being the best compression. The default is 9.


axiom.Zip.close()

Description

axiom.Zip.close()

Closes the zip archive. This method should be called when all operations have been finished, to ensure that no open file handles are left.


axiom.Zip.extract()

Description

axiom.Zip.extract(name, destPath)

Extracts a single file from the zip archive represented by this axiom.Zip instance.

Parameters

  • name (String) - Name of the file to extract.
  • destPath (String, Optional) - If specified, will write the extracted file to this location.

Returns (Object) - An axiom.Zip.Entry Object.


axiom.Zip.extractAll()

Description

axiom.Zip.extractAll(destPath)

Extracts all the files from the zip archive represented by this axiom.Zip instance.

Parameters

  • destPath (String, Optional) - If specified, will write the extracted file to this location.

Returns (Object) - An axiom.Zip.Content Object.


axiom.Zip.extractData()

Description

axiom.Zip.extractData(zipData)

Extracts zip data from a ByteArray.

Parameters

  • zipData (ByteArray) - The zip data to extract.

Returns (Object) - An axiom.Zip.Content Object.


axiom.Zip.getData()

Description

axiom.Zip.getData()

Returns a ByteArray of the current zip file.

Returns (ByteArray) - ByteArray of the current zip file.


axiom.Zip.list()

Description

axiom.Zip.list()

Extracts all the files from the zip archive represented by this axiom.Zip instance.

Returns (Object) - An axiom.Zip.Content Object.


axiom.Zip.save()

Description

axiom.Zip.save(dest)

Saves the Zip Archive.

Parameters

  • dest (String) - Destination to save.




axiom.Zip.Content()

Description

axiom.Zip.Content()

Constructor method for axiom.Zip.Content Objects.


axiom.Zip.Content.toc

Description

axiom.Zip.Content.toc

(Array) - Array of axiom.Zip.Entry Objects.


axiom.Zip.Content.files

Description

axiom.Zip.Content.files

(Object) - An Object whose properties are the names of the files in the zip file, with their corresponding values being axiom.Zip.Entry Objects.


axiom.Zip.Content.add()

Description

axiom.Zip.Content.add(entry)

Adds an axiom.Zip.Entry Object to the current axiom.Zip.Content Object.




axiom.Zip.Entry()

Description

axiom.Zip.Entry(entry)

Constructor method for axiom.Zip.Entry Objects.

Parameters

  • entry (java.util.zip.ZipEntry) - Takes a java ZipEntry object, and creates a JavaScript Object with the properties described below.


axiom.Zip.Entry.name

Description

axiom.Zip.Entry.name

(String) - Name of the entry.


axiom.Zip.Entry.size

Description

axiom.Zip.Entry.size

(Number) - Decompressed size of the entry in bytes.


axiom.Zip.Entry.time

Description

axiom.Zip.Entry.time

(Date) - Last modification timestamp of the entry or null.


axiom.Zip.Entry.isDirectory()

Description

axiom.Zip.Entry.isDirectory()

Returns whether or not this entry is a Directory.

Returns (Boolean) - True in case entry is a directory, false otherwise.


axiom.Zip.Entry.data

Description

axiom.Zip.Entry.data

(ByteArray) - ByteArray containing the data of the entry.