2012年1月26日 星期四

ZipFile module

ZipFile Ti Module for iOS


Steps to download and install zipfile module:

  1. download zipfile module from http://kosso.co.uk/stuff/zipfile-iphone-0.1.21.zip
  2. unzip and place into /Library/Application Support/Titatnium/modules/, like this ~/modules/iphone/zipfile/0.1.21/...
  3. Edit tiapp.xml to include the module:
    <modules> 
         <module version="0.1.21">zipfilemodule> 

        modules>

  4. restart Titanium Studio and remove build folder.

To use:
var zipfile = require("zipfile");
zipfile.extract(zipFileLocation, unzipFileLocation);

where zipFileLocation = /User/...Library/......
Note:
Since 1.7.0 the Filesystem has been changed to return a localhost url ('file://localhost/User/...') for properties such as applicationDataDirectory.
While zipfile only work on native file path without the prefix 'file://localhost'.


var dataDir = Ti.Filesystem.applicationDataDirectory.slice(0,Ti.Filesystem.applicationDataDirectory.length - 1).replace('file://localhost','').replace(/%20/g,' ');
dataDir = dataDir + '/../Library/Caches/';


Module development guide
https://wiki.appcelerator.org/display/guides/iOS+Module+Development+Guide#iOSModuleDevelopmentGuide-TestingyourModule

ZipFile Ti Module for Android

Titanium official module: 

websiteburo's androzip: 

沒有留言:

張貼留言