GithubHelp home page GithubHelp logo

anezipfile's Introduction

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

anezipfile's People

Contributors

xperiments avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.