Giter VIP home page Giter VIP logo

ti.compression's Introduction

Ti.Compression Module

Description

Lets you zip and unzip files.

Getting Started

View the Using Titanium Modules document for instructions on getting started with using this module in your application.

Accessing the Ti.Compression Module

To access this module from JavaScript, you would do the following:

var Compression = require('ti.compression');

Functions

string zip(string archiveFile, string[] fileArray)

Compresses all of the files you pass in "fileArray" to the specified "archiveFile".

Arguments

  • string archiveFile: The path to the archive file to create
  • string[] fileArray: An array of files to compress

Returns the string "success" if the operation succeeded, or an error message if something went wrong.

string unzip(string destinationFolder, string archiveFile, bool overwrite)

Extracts the files in the archive file into the destination folder, optionally overriding existing files.

Arguments

  • string destinationFolder: The destination folder for the extracted files
  • string archiveFile: The path to an existing compressed archive file
  • bool overwrite: Indicates if existing files should be overwritten

Returns the string "success" if the operation succeeded, or an error message if something went wrong.

Usage

To create an archive:

var result = Ti.Compression.zip('test.zip', [ 'a.dat', 'b.dat', 'c.dat' ];

To extract an archive:

var result = Ti.Compression.unzip(Ti.Filesystem.applicationDataDirectory + 'data', 'test.zip', true);

See example for more details.

zip Parameter

Android:

  • filename:String, files:Array, options: Object [compression: Compression.BEST_SPEED | Compression.DEFAULT_COMPRESSION | Compression.NO_COMPRESSION]

iOS:

  • filename:String, files:Array

Create demo files

Create demo files

good compression (no content)

truncate -s 5M file1.dat

Bad compression (random content)

dd if=/dev/urandom of=file1 bs=5M count=1

Author

Clint Tredway

License

Copyright(c) 2010-present by Axway Appcelerator. All Rights Reserved. Please see the LICENSE file included in the distribution for further details.

ti.compression's People

Contributors

aakash-jain-axway avatar ashcoding avatar caspahouzer avatar cb1kenobi avatar dependabot-preview[bot] avatar dependabot[bot] avatar ewanharris avatar garymathews avatar hansemannn avatar ingo avatar janvennemann avatar jawa9000 avatar jonalter avatar m1ga avatar muhammaddadu avatar pec1985 avatar sgtcoolguy avatar ssjsamir avatar stephenfeather avatar yomybaby avatar ypbnv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ti.compression's Issues

zip64 no longer supported

Please see this Appcelerator Jira ticket, I have managed to re-build and solve the issue unfortunately my tooling is in a mess and I didn't clone so I can't issue a pull request, plus I'm not actually sure the version of minizip that I used to fix this as I just re-built with my year old fix to solve the issue. Sorry!

https://jira.appcelerator.org/browse/AC-6560

iOS 64 bit support is missing.

We have been using your Compression Module since Ti SDK 3.1, but now we have to support iOS x64 architecture. So we upgraded our app to TI SDK 3.5 and it started giving me this error:-
[ERROR] : Script Error Couldn't find module: ti.compression for architecture: x86_64

I believe we need to upgrade this module in-order to support Ti SDK 3.5. Can you please help us on this.

Not Working with Ti SDK 8.0.0

I've try to use this module with SDK 8.0.0 and there is a problem during the compilation :

[TRACE] Undefined symbols for architecture x86_64:
[TRACE]   "_deflate", referenced from:
[TRACE]       _zipWriteInFileInZip in libti.compression.a(zip.o)
[TRACE]       _zipCloseFileInZipRaw in libti.compression.a(zip.o)
[TRACE]   "_deflateInit2_", referenced from:
[TRACE]       _zipOpenNewFileInZip3 in libti.compression.a(zip.o)
[TRACE]   "_inflate", referenced from:
[TRACE]       _unzReadCurrentFile in libti.compression.a(unzip.o)
[TRACE]   "_get_crc_table", referenced from:
[TRACE]       _unzOpenCurrentFile3 in libti.compression.a(unzip.o)
[TRACE]       _zipOpenNewFileInZip3 in libti.compression.a(zip.o)
[TRACE]   "_deflateEnd", referenced from:
[TRACE]       _zipCloseFileInZipRaw in libti.compression.a(zip.o)
[TRACE]   "_inflateInit2_", referenced from:
[TRACE]       _unzOpenCurrentFile3 in libti.compression.a(unzip.o)
[TRACE]   "_inflateEnd", referenced from:
[TRACE]       _unzCloseCurrentFile in libti.compression.a(unzip.o)
[TRACE]   "_crc32", referenced from:
[TRACE]       -[TiCompressionZipArchive addFileToZip:newname:] in libti.compression.a(ZipArchive.o)
[TRACE]       _unzReadCurrentFile in libti.compression.a(unzip.o)
[TRACE]       _zipWriteInFileInZip in libti.compression.a(zip.o)
[TRACE] ld: symbol(s) not found for architecture x86_64
[TRACE] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR] ** BUILD FAILED **
[ERROR] The following build commands failed:
[ERROR]         Ld /Users/buje/Documents/Appcelerator/o-m/build/iphone/build/Products/Debug-iphonesimulator/****** normal x86_64
[ERROR] (1 failure)

Windows Mobile support

Hi,

This module only supports Android and iOS. Is Windows Mobile on the roadmap for this Module?

Regards

ios Problem

message = "-[TiFilesystemFileProxy hasPrefix:]: unrecognized selector sent to instance 0x7fbfa57692f0";

Please Help

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.