Pretty neat way of zipping files I found for Actionscript. However here is a way how you can use it for HTML / Javascript Air SDK version

  1. Download swc file for airxzip: http://code.google.com/p/airxzip/downloads/list
  2. Unzip *.swc file. If you having problems unzipping it, rename it to *.zip first
  3. Copy library.swf into your project folder, rename it if required
  4. Include swf file into your html page the way you include javascript source:

    
    <script src="/library.swf" type="application/x-shockwave-flash"></script>
    
    

    Create helpful method somewhere in your libraries:

    
    var zipFile = function(source, destination) {
    	try {
    		var writer = new window.runtime.com.coltware.airxzip.ZipFileWriter();
    		writer.open(air.File.applicationStorageDirectory.resolvePath(destination));	      
    		writer.addFile(air.File.applicationStorageDirectory.resolvePath(source), source);
    		writer.close();
    		return true;
    	} catch(e) {
    		return false;
    	}
    };
    
    

    Now you can start zipping files. Good Luck!

    
    zipFile(source, destination);
    
    

    Dima Svirid

    Software architect, JAVA, Spring, Hibernate, AngularJs, Backbone, MongoDB, Oracle. CTO and Co-Founder of Homeadnet.com

    More Posts

    Follow Me: