Skip to content

Latest commit

 

History

History
155 lines (98 loc) · 5.59 KB

README.md

File metadata and controls

155 lines (98 loc) · 5.59 KB

ANEZipFile

Adobe AIR iOS Native Extension to zip/unzip files.

Uses a slightly modified verion of SSZipArchive Obj-C https://github.com/soffes/ssziparchive

Features:

Unzip

  • Unzip Files Asynchronously
  • Unzip password protected files
  • Unzip single file from zip to ByteArray ( Sync/Async )
  • List Files inside zip
  • Determine if zip is password protected

Zip

  • Zip contents of a directory from FileSystem Asynchronously
  • Zip group of Files from Filesystem Asynchronously
  • Append files from FileSystem to zip ( Sync/Async )
  • Append ByteArray Data to a file inside zip ( Sync/Async )

Todo

  • Add working example
  • Enable creation of password protected zips

Actionscript Classes

ANEZipUtils Methods

listDirToZip(folder : File) : Array;

List Directory contents of folder.
Returns an array of file paths.

extractFile(zipfile : File, fileName : String, password : String = "") : ByteArray;

Synchronously gets the contents of a single file in zip.
Return ByteArray data of the extracted file.
Pass a password if the zip file is password protected

extractFileAsync(zipfile : File, fileName : String, password : String = "") : void;

ASynchronously gets the contents of a single file in zip.
Pass a password if the zip file is password protected.
Dispatches ANEZipFileEvent.UNZIP_FILE_BYTES.
    event.resultBytes -> will contain the file ByteArray representation.

getZipContents(zipfile : File) : Array;

Get a list of the files inside the zip

isPasswordProtected(zipfile : File) : Boolean;

Determines if the provided zip file is password protected

unzip(zipfile : File, destination : File, overwrite : Boolean = false, password : String = "") : void;

Unzips a zip file to the filesystem.

Dispatches ANEZipFileEvent.UNZIP_START when the process is started.

Dispatches ANEZipFileEvent.UNZIP_END when the process is finished.
    event.eventData will contain:
    * source        -> path of original zip file
    * destination   -> path of the destination dir
    
Dispatches ANEZipFileEvent.UNZIP_PROGRESS while processing.
    event.eventData will contain:
    * current   -> current index of decompressed file
    * total     -> total files to decompress inside zip
    * path      -> current decompressed file path

zipDirectory(outputZip : File, sourceDirectory : File) : void;

Zips the contents of a directory

Dispatches ANEZipFileEvent.ZIP_START when the process is started.
    event.eventData will contain:
    * path   -> Path to the generated zip file

Dispatches ANEZipFileEvent.ZIP_END when the process is finished.
    event.eventData will contain:
    * path      -> Path to the generated zip file
    * success   -> Success of the zip action
    
Dispatches ANEZipFileEvent.ZIP_PROGRESS while processing.
    event.eventData will contain:
    * current   -> current index of compressed file
    * total     -> total files to compress inside zip

zipFiles(outputZip : File, sourceFiles : Array, destinationFiles : Array = null) : void;

Zips files to a zip.

Dispatches ANEZipFileEvent.ZIP_START when the process is started.
    event.eventData will contain:
    * path   -> Path to the generated zip file

Dispatches ANEZipFileEvent.ZIP_END when the process is finished.
    event.eventData will contain:
    * path      -> Path to the generated zip file
    * success   -> Success of the zip action
    
Dispatches ANEZipFileEvent.ZIP_PROGRESS while processing.
    event.eventData will contain:
    * current   -> current index of compressed file
    * total     -> total files to compress inside zip

ANEZipFile Methods

addFile(file : File, destination : String = "") : Boolean;

Add a file to the zip

addFileAsync(file : File, destination : String = "") : void;

Add a file to the zip ASynchronously

close() : Boolean;

Closes de current zip file

dispose() : void;

Disposes instance

open(zipfile : File, fileMode : uint = 0) : Boolean;

Open a zip file for create / append files.

Avaliable filemodes are:
    * ANEZipFile.FILE_MODE_CREATE
    * ANEZipFile.FILE_MODE_APPEND

writeBytes(bytes : ByteArray, fileName : String) : Boolean;

Write ByteArray data to a file in zip

writeBytesAsync(bytes : ByteArray, fileName : String) : void;

Write ByteArray data to a file in zip ASynchronously

License

Creative Commons License

A slightly modified version of SSZipArchive that is licensed under the MIT license

Thanks

Thanks soffes for creating SSZipArchive which ANEZipFile is based on