Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

7zip, lzma, LZ4, fastLZ, zip/gzip & brotli native multiplatform plugins.

Discussion in 'Assets and Asset Store' started by elias_t, Nov 16, 2013.

  1. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    [Unity5, 2017,2018, 2019 ready]

    7zip decompression, lzma alone, zip/gzip, LZ4, fastLZ & brotli compression/decompression native library for Android, iOS*, Windows, OSX, Linux & webGL** has been released on the asset store.

    https://assetstore.unity.com/packag...z-zip-gzip-brotli-multiplatform-plugins-12674


    * ZIP plugin: iOS/tvOS compilation may require to add the -lz linking flag at Build Settings-> Linking-> Other Linker flags on xcode.


    **webGL supports flz,lzma & lz4 buffers compression/decompression only. It also supports all the zip functions except those that require file system access.

    If you are publishing for MacOS on the AppStore please do the following to codesign the bundle:

    1. Remove all the meta files from inside the .bundle.
    2. Remove (if any) folder named CodeSignature.
    3. Find the Info.plist file and change the bundleID to one of your own.



    FEATURES:


    7ZIP section:

    [it is recommended to work with non solid 7z archives because they are getting processed faster!]

    The library serves the scope to have fast decompression of 7z files and compress/decompress lzma files and buffers.

    - The library does 7z decompression and not 7z compression.
    Compression of lzma alone files is supported.
    Passwords are not supported.

    - It is about 2.5x times faster then using a c# implementation for 7z decompression.

    - You can extract a single file out of the 7z archive.

    - If you intend to decompress large files it would be better to use the largeFiles flag.(consumes less ram)

    - You can extract the contents of the 7z file keeping its folder structure.

    - Ability to get the filenames and file sizes of files in a 7z archive.

    - Ability to encode/decode to/from .lzma alone format.

    - Ability to decode a specific file in a 7z archive to a byte buffer.

    - get byte level progress of 7z decompression (single or multiple files).

    - get byte level progress of lzma compression/decompression.

    - Ability to decode/encode a byte buffer to/from the lzma alone format.

    - Ability to cancel 7zip extraction when it contains multiple entries.


    ZIP / gzip section:

    Fast zip/gzip/tar/bz2 compression and decompression with a clean and simple interface. Very easy to use. Well commented example and documentation.

    The plugin is about 7x times faster in compression speed and 3x times faster in decompression speed compared to SharpZipLib.

    - compress/decompress buffers to/from zlib/gzip streams.

    - recursive directory compression/decompression.

    - compress/decompress single files.

    - encryption / decryption.

    - append files to existing zip archives.

    - compress a buffer and write it or append it to a zip archive.

    - get file and size info of all the files or a specific file from a zip archive.

    - extract a single file out of a zip archive.

    - decompress a file of a zip archive to a byte buffer.

    - delete an entry in a zip archive.

    - replace an entry in a zip archive.

    - get progress of extraction when the zip archive has multiple files.

    - get byte level progress of compression/decompression (single or multiple files).

    - create in Memory zip files and manipulate them from there.

    - Support of split zip files compress/decompress (1.zip. 1.z01, 1.z02, ...)

    - decompression of split zip archives (in the form of 1.zip, 1.z01, 1.z02, ...)

    - ability to discover merged/hidden zip/gzip archives in files or buffers and extract from there.

    - bz2/zlib compression-decompression methods. (bz2 method not available for MacOS/iOS/tvOS & webGL)

    - buffers can be treated as files. That means if you have a file in www.bytes you can perform operations directly on the buffer.

    - support for STORE method when setting level of compression to zero.

    - ability to cancel most zip/unzip operations when they are called from a Thread.

    - create/decompress gzip files.

    - ability to create tar archives from directories or list of files with byte level progress.

    - untar and untar entry support with byte level progress.

    - compress/decompress of tar.gz, tar.bz2 with progress.

    - create and decompress bz2 archives with progress.

    - thread safe



    LZ4 section:

    Fast compression/decompression of files in LZ4 format.

    - compress a file into a LZ4 file format.

    - decompress an LZ4 file.

    - compress a buffer into the LZ4 format.

    - decompress an LZ4 compressed buffer into a buffer.

    - progress of operations.

    (The plugin provides a solution to store the uncompressed size of a compressed buffer in its footer.)


    fastLZ section:

    Fast compression/decompression of files in fastLZ format.

    - compress a file into a fastlz file format.

    - decompress a fastlz file.

    - compress a buffer into the fastlz format.

    - decompress a fastlz compressed buffer into a buffer.

    - progress of operations.

    (The plugin provides a solution to store the uncompressed size of a compressed buffer in its footer.)


    brotli section:

    Fast brotli compression and decompression with a clean and simple interface. Very easy to use.

    - compress a file into a brotli file format.

    - decompress a brotli file.

    - compress a buffer into the brotli format.

    - decompress a brotli compressed buffer into a buffer.

    (The plugin provides a solution to store the uncompressed size of a compressed buffer in its footer.)



    *Linux, iOS, Android, MacOSX can treat buffers as files. (On Windows the zip plugin can treat buffers as files as well.)


    The ios and OSX libraries are compiled as universal. That means that they will support 32 and 64 bit builds.

    The Windows and Linux libraries are compiled for x86 and x86_64 build modes.
    The Android lib is compiled for arm64-v8a, armeabi-v7a and x86.

    iOS/tvOS plugins are standard bitcode enabled. If you are using a non bitcode project please use the appropriate plugins that reside in the non-bitcode folders.

    If you want to get only the zip plugin it is also sold separately here:

    https://www.assetstore.unity3d.com/en/#!/content/39411

    --------------------------------------------------------------------------------------------------
    version 2.7 [Major update]

    - 7ZIP: Added byte level progress for 7zip extraction (whole files/fileBuffers or entries)
    - 7ZIP: Added byte level progress for lzma alone creation/decompression.
    - 7ZIP: For this reason 3 new functions have been introduced. See examples and docs.
    - 7ZIP: Improved entry search and extraction speed.
    - 7ZIP: Fixed an issue with entries extraction, where some unwanted empty folders could be extracted.
    - 7ZIP: Decompress buffer imporoved.
    - 7ZIP: Fixed issues with files larger then 2GB on 64bit systems.
    - 7ZIP: Linux: reintroduced FileBuffers for Linux.
    - 7ZIP: Protection against illegal characters in 7z entries.
    - 7ZIP: The get7zInfo and get7zSize functions run faster and no more a temp log is needed.

    - LZ4: Progress of decompression is a ulong now.


    - ZIP: Added support for tar/untar.
    - ZIP: Added support for tar.gz, tar.bz2 creation.
    - ZIP: Protection against illegal characters in entries.
    - ZIP: Added ability to create and decompress bz2 files.
    - ZIP: Faster reaction to the cancel command.
    - ZIP: Fixed gzip file decompression issues.
    - ZIP: gzip uncompress progress relies on the compressed files size now.

    - ALL: tvOS uses the same functions as WebGL now, since it does not allow access to the file system.
    - ALL: Combined tvOS and WebGL in one demo scene.
    (WebGL sample scenes renamed to reflect the above changes.)
    - ALL: Updated and refactored the demo scene and scripts to reflect the new changes.
    - ALL: Removed the Streaming Assets folder files. All example files are downloaded now.

    - ALL:LINUX: Only one glibc version of Linux plugins now provided (glibc2.17)

    In general, a lot more has been done to improve the stability and usability of the plugins.

    update version 2.6.3

    - Brotli: Fixed the buffer functions.


    Update version 2.6.2
    - 7zip: Windows: Unicode issues resolved.
    - 7zip: Added a cancel function when decompressing 7zip archives with multiple entries.
    - 7zip: Linux: FileBuffers disabled for now on Linux since they are not stable.
    - ZIP: Hotfix: the previous update broke the decompression of zip file. It is now fixed!
    - ZIP: Added 2 new functions to gzip and ungzip archives on the File System.


    update version 2.6.1
    - ZIP: Hot fix for zips that contain the __MACOSX folder.
    - ZIP: Added simulator plugin for iOS.


    update version 2.6 (ZIP: Important feature and maintenance update)
    - ZIP: Setting level of compression to zero will now use the STORE method.
    - ZIP: Added the setCancel() function to cancel the compress_File, compressDir, compress_File_List, decompress_File, extract_entry, entry2Buffer functions.
    - ZIP: Added the ability to get byte level progress when compressing files.
    - ZIP: Android arm64-v8a plugin should decompress files larger then 2GB now.
    - ZIP: Windows: compression with unicode characters in path should work correct now.
    - ZIP: The getEntrySize function returns a ulong value now.
    - ZIP: The getFileInfo function filled Lists for uncompressed, compressed and localOffset are filled with UInt64 values now.
    - ZIP: The getFileInfo function fills a new list localOffset. Useful for archives with the STORE method to find the position in the zip. (you should add + 30 bytes + name.length to get the final offset)
    - ZIP: Demo script updated to reflect the new changes.
    - 7zip: When extracting a 7z archive the output folder should be created when not existing now.


    update version 2.58
    - ZIP: fixed WebGL issues on Unity 2019.x
    - fixed ios/tvos issue with bitcode plugins on xcode 11.x
    - Lzma/7zip: fixed issue with the windows plugins. Now bcj and ppmd are back.
    The ios/tvos plugins include xcode 10.3 and 11.4 bitcode compiled versions.


    update version 2.57
    - ZIP: Process of decompression in bytes now returned as ulong.
    - ZIP: Fixed an issue with ios/tvOS caused by the 1.64 update.


    update version 2.56
    - ZIP: Hotfix for the compressDir/compress_File_List functions. The plugin could crash when thousands of files were going to get compressed.

    update version 2.55
    - ZIP: Using compress_File/compress_File_List/compressDir to append multiple files to a zip were very slow. Now compress_File_List and compressDir work very fast.
    - ZIP: For the same reason the inMemory class got some low level functions to allow much faster appending of multiple entries. See examples and docs.


    update version 2.54
    - ZIP: Critical fix for the inMemory zip creation functions. All users that use these functions should update to this version.
    - ZIP: Added a public function to the inMemory struct for getting the byte[] buffer of the inMemory created zip.


    update version 2.53 [Major update]
    - ZIP: WebGL has now full zip support. Obviously not on the file system but on memory buffers. (bz2 method not supported yet.)
    - ZIP: Webgl got zlib buffer support again. (Was misplaced in a previous update.)
    - ZIP: Added the ability to find merged/hidden zip/gzip archives in files or buffers and extract/get info from them.
    - ZIP: iOS/tvOS: fixed potential issues with admob/facebook/google sdk.
    - ZIP: Windows/Android: fixed bz2 issue.
    - ZIP: bz2 method support for inmemory compression. (not for macos/ios/tvos/webgl.)
    - All Plugins-tvOS: fixed preprocessor issues on newer versions of Unity.
    - plugin binary sizes got smaller.
    - updated the benchmark script.

    update version 2.52
    - ZIP: fixed some C# issues with the compress_dir and compress_file_list functions.


    update version 2.51
    - ZIP: iOS/tvOS: fixed duplicate symbol issue with Unity2018.

    update version 2.50
    - ZIP: iOS/tvOS: fixed some conflict issues with the Facebook SDK.


    update version 2.49
    - tvOS plugins were accidentally not provided as bitcode by default.

    update version 2.48
    - tvOS has its own plugin folder now.
    - iOS/tvOS plugins are provided by default as bitcode enabled. (non bitcode versions are still provided.)


    version 2.47
    - 7z/lzma: fixed some issues with the windows plugins.
    - ZIP: Added the ability to create In Memory zip archives and manipulate them.
    - MacOS: removed the 32bit only bundle.
    - Replaced the www functions with UnityWebRequest.
    - Removed the watchOS plugins.
    - Docs updated.


    update version 2.46

    - LZMA/Windows x86/Il2cpp: fixed a crash issue.

    update version 2.45
    - Android arm64 plugins for brotli, flz, lz4 & 7zip updated to fix a crash when using FileBuffers.

    update version 2.44
    - ZIP: buffer2File fix. (was adding modified time field when it was not needed.)
    - Added Linux glibc 2.17 version plugins (useful for SteamOS).


    update version 2.43
    - ZIP: Fixed some preprocessor directives.

    update version 2.42
    - ZIP: Added the ability to create split zip archives.
    - ZIP: Fixed an issue with the iOS bitcode enabled plugin.

    update version 2.4
    - Addded arm64-v8a Android support for all plugins.
    - Removed WSA support for all plugins.
    - Separated the plugin folders for each category.
    - MacOS plugins compiled only for 64 bit now.
    - ZIP: Resolved some il2cpp issues.
    - ZIP: Unicode filenames on decompression should work now on Windows.
    - LZ4/WebGL compress buffer fix.


    update version 2.32
    - ZIP: Hotfix for password encoded zip files not creating folders.
    - ZIP: Hotfix for the compressDir function.


    update version 2.31
    - ZIP: Added the entry2FixedBuffer function to decompress an entry to a fixed size buffer.
    - ZIP: The getFileInfo is now much faster on zip archives with thousands of files.


    update version 2.30
    - ZIP: Added the getEntryDateTime function, to get DateTime for a specific entry
    - Updated the file sample links of the demos, due to a server switch.

    update version 2.29
    - ZIP: Removed encryption/decryption for WSA due to certification reasons.

    update version 2.28.2
    - ZIP: iOS/MacOS Hotfix.
    - ZIP: bz2 method removed for MacOS/iOS/watchOS/tvOS because it is not working correctly.


    update version 2.28 [Major zip plugin update]
    - Zip: Added Encryption/Decryption support.
    - Zip: Added bz2 as an alternative compression/decompression method of zip archives.
    - Zip: WSA supports now FileBuffers.
    - Zip: On WSA encryption is supported only on UWP10 x64.
    - Zip: Better Unicode support on Windows platforms.
    - Zip: Faster and more reliable getInfo function. (intermediate file is not used anymore.)
    - Zip: Low level functions have been removed due to inconsistency between platforms.
    - Zip: Added the ability to compress a list of files into a single archive.


    update version 2.27
    - Added webGL LZ4 support for compression / decompression of buffers.


    update version 2.26
    - Reintroduced webGL support for zip/gzip, flz and lzma compression/decompression of buffers.

    update version 2.25
    - Zip: hotfix for zip files which use backslashes instead of slashes for directories
    - Zip: Linux/MacOS fixes for the low level functions on standalone builds.
    - Zip/ios: watchOS & tvOS. Added simulator plugins.


    update version 2.24
    - Zip: Added zip64 support.
    - Zip: Added low level functions (except for WSA) - see demo and lzip.cs.
    - Zip: WSA8.1 fixes.
    - Zip: Added a setEncoding function for Windows and WSA10 to set text encoding on file names.
    - Zip: Added a validate function to check sanity of zip files.
    - Zip: The getTotalFiles will now return only the true files number (no folders and no zero byte files).
    - All plugins: Removed WebGL support since it is almost impossible to work on Unity5.5.


    update version 2.21
    - fix for a WSA/x86/il2cpp crash.


    update version 2.2
    Removed WebGL support for the LZ4 plugin since there are too many conflicts with Unity5.5.
    If you have the LZ4 WebGL plugin in your project and you are on Unity5.5 you are advised to removed it.


    version 2.19
    zip/All platforms: added the delete_entry function to delete an entry in a zip file.
    zip/All platforms: added the replace_entry function to replace an entry in a zip file(from a filepath or a buffer).

    version 2.18
    iOS/zip/bitcode: removed older version of bitcode compiled lib which was missing the new ungzip function.

    version 2.17
    zip/Windows: A small fix to the getTotalFiles function to allow to work correctly with FileBuffers.


    update version 2.16
    ZIP All Platforms-gzip: Fixed a bug that was introduced in a previous update that had to with the outbuffer length. Now the gzip functions behave as intended.
    ZIP Windows: Now you can treat a zip file that is loaded in a byte buffer as a file.
    ZIP ios/gzip: updated the gzip functions.


    update version 2.15
    Linux: fixed preprocessor directives for Unity5.4.x and up.


    update version 2.14
    gzip: Fixed Android issues and added a 2nd ungzip function.


    update version 2.13
    zip/Windows: better unicode support. Unity5.4 compatibility fix.


    update version 2.12
    lzma: fixed a bug with lzma compression. (lzma compression on already compressed files would produce corrupted lzma files.)


    update version 2.11
    zip/iOS: hotfix to fix a GcHandle crash.
    LZ4: added compress buffer to a specific location of a fixed size buffer.
    LZ4: added decompress an lz4 buffer from a specific location of a fixed size buffer



    version 2.1 (Major update)
    - Added Brotli support for all platforms except WebGL & watchOS.
    - zip: added gzip support. Can operate on buffers with or without headers/footers.
    - zip: added progress for individual file decompression.
    - Android, Linux, iOS, MacOSX got chmod support to set file permissions.
    - iOS: made the plugins much smaller in size.
    - Reorganized the demo folders. You are adviced to delete the demo folders before updating the sample scenes.



    update version 2.09
    - Added bitcode supported plugins for iOS.


    update version 2.08
    - Compatibility fixes for Windows Phone 8.1 and WSA8.1. Sdk8.1 should work out of the box now without the need to provide your own IO functions.
    - Added a benchmark scene.


    Update version 2.06
    - Winx86, Winx86_64 & WSA plugins: full unicode support on paths and filenames.


    Update version 2.05 (important update)
    - progress functions are the same on all platforms now. That introduced a small breaking code change.
    Instead of providing a referenced integer or float you provide a single item integer of float array.
    Removed deprecated iOS functions to get progress.
    - iOS: renamed some native functions to avoid collision with unity's libiphone lib.
    - lzma: added a function to decompress a compressed Asset Bundle (lzma format/ lz4 format under investigation).
    - lzma: added an example on how to decompress a compressed asset bundle from the StreamingAssets Folder.
    - zip: fixed an issue with decompressing of zip files conataining the '__MACOSX' folder.
    The '__MACOSX' folder will be ignored along with files starting with '._' and files with 0 bytes size.

    version 2.0 (Major update)
    - Added WebGL support for all plugins!
    - Linux, iOS, Android, MacOSX can treat now buffers as files. That means if you have a file in www.bytes
    you can perform operations directly on the buffer.
    For Android this is very useful since you can decompress from Streaming Assets without copying to
    Persistent data path.
    - all plugins/all platforms: added support for fixed buffer operations to avoid memory allocations.
    - lzma: added support for partial buffer compression.
    - lzma: added the ability to modify the compression properties for buffers and lzma alone files.
    - refactored the preprocessor directives to comply with Unity 5.3.
    - iOS: simulator plugins have now universal, i386 and x86_64 variations.


    version 1.9.1
    - added fastLZ support.
    - added LZ4 buffer compression level.


    version 1.9
    - Added LZ4 support. (Read the dedicated documentation for it.)
    - Discontinued Blackberry support.
    - Minor improvements for the lzma plugins.
    - WSA10: Accidentally in the previous update the largeFiles support for 7z files was removed. Now it is back in.
    - added a folder with the plugins separated as unitypackage files.


    Update version 1.8

    - iOS: added tvOS, watchOS and simulator plugins.
    - Unity5.2: added WSA SDK10 NetCore support.


    version 1.7.6
    - 7zip iOS: fixed a bug in the get7zInfo function when extracting from the StreamingAssets folder.
    - zip iOS : updated the ios plugins to have minimum iOS support 6.0


    update version 1.7.5
    - removed vc++2013 dependency for windows editor.
    - zip/7zip iOS: added extra workaroud functions to get the progress of files when extracting multiple files in multiple threads. See documentation!


    update version 1.7.4
    - 7zip iOS: added an extra function to get properly the progress of the extracted files.
    - 7zip iOS: now you can use the largeFiles flag when decompressing a file that is stored in StreamingAssets to some other folder with writing permissions.
    - zip: - added 2 global integers zipFiles & zipFolders that get updated when calling the getFileInfo function.


    update version 1.7.3
    - Fix for the CompressDir function for the zip plugin.
    - Total true files in a 7zip file are counted now when calling the get7zInfo function and stored in the trueTotalFiles integer variable.


    update version 1.7.21
    - Hotfix for iOS. Issue was conflicting functions between the zip and 7zip plugin.

    update version 1.7.1
    - cleaned up 7z/lzma cs files.
    - added a second method on 7zip decompression for not forcing the user to use a ref int to get the extraction progress when not needed/wanted.


    update version 1.7
    MAJOR UPDATE:

    - Added full ZIP support (see apropriate documentation for more). In short, compression/decompression of files/directories and buffers is supported on all platforms.
    - Changed the way how the decompression progress of archives with multiple files is returned. Now you have to provide a referenced integer where the progress will be written to. This was done to avoid shared memory violations when having multiple threads calling the same function.
    - Progress works now for Linux and Win8.1 (Phone and WSA)
    - Removed some obsolete functions and revamped the code. - Added an example for Android, to copy a file from the StreamingAssets folder to the PersistantDataPath and do there file operations.
    The zip package will be sold also as a cheaper single package.


    update 10/06/2015 version 1.6.2
    - critical bug fixed in the 7z decode2Buffer function that caused a crash. Works as expected now.


    update 02/06/2015 version 1.6.1
    - cleaned up the cs code. Less preprocessor directives used now.
    - updated Blackberry plugin. Added x86 binary.

    update 30/05/2015 version 1.6

    Major update:
    -Ability to compress a buffer to the lzma format and to decompres a buffer that is in the lzma format.
    -Added basic support for Windows Phone 8.1 and WSA plugins.
    -Added a method to get the current number of files extracted from a 7z archive. Provides a solution to get progress of decompression when the 7z archive has multiple files.
    - Fixed a bug in the Linux plugin where folders where not created correctly.
    More details in the documenation.


    update 16/05/2015 version 1.5.8 Added ppmd decompression method support.

    update 28/04/2015 version 1.5.7
    Adressed memory leak issues and changed the get7zInfo and get7zSize functions. It is recomended to use this version if you are calling the above functions on 7z archives that contain hundreds or thousands of files.

    update 19/02/2015 version 1.5.5
    Added the ability to decode a specific file in a 7z archive to a byte buffer.

    update 03/02/2015 version 1.5
    Added the ability to get filename and file size information of a 7z archive.
    Added the ability to encode/decode to/from .lzma alone format.

    The 1.4.5 version is included also zipped in case somebody wants to use the basic functionality of the lib
    because the newer versions have grown in size.


    update 28/01/2015 version 1.4.5

    Experimental Blackberry support added.


    update 22/01/2015 version 1.4

    Added OSX and Linux support.


    update 12/12/2014

    Added support for x86 and x86_64 Windows. A macOS version might come in the future. Removed crc checks on android and ios builds for faster extraction.


    update 10/12/2014 version 1.2.5

    Added support for x86 Android builds. Changed the folder structure of the Plugins/Android folder. Now the plugins for each platform reside in their own folder named after the platform. You don't have to do anything. Unity will copy the correct lib for you wether you build for arm, x86 or both (fat binary).


    update: 12/11/2014 version 1.2.1

    - By mistake in the previous version the iOS library was the Debug one.
    - 3 compiled versions of the library are now included. Debug, Fast and Small, Agrresive optimizations (faster and bigger)
    (the variations are included as zip files in the plugins/iOS folder. Unzip the one you want to use)

    Default is: Fast and Small


    update: 12/11/2014 Added iOS support.
     

    Attached Files:

    Last edited: Jun 22, 2020
  2. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Unfamiliar with 7zip decompression on Android, use case?
     
  3. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi.

    A use case is when you want your application to download from a server data and you want them to have high compression to reduce download time and perhaps costs (when on 3g).

    I developed it having such projects in mind and I am actually using it in one that needs this.
     
  4. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Support for iOS has been added.
     
  5. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,703
    7zip is the bomb. Cool stuff. Useful for optimizing download speeds for sure.
     
  6. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Yes it saved my live in an application that had to download a lot of external files as updates.
    The lib is already battle proven.
     
  7. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,703
    I kind of wish unity would expose 7z compression/decompression easily for use in apps, they already have it built into the editor for building the webplayer etc.
     
  8. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Update: 12/11/2014 version 1.2.1

    - By mistake in the previous version the iOS library was the Debug one.
    - 3 compiled versions of the library are now included. Debug, Fast and Small, Agrresive optimizations (faster and bigger)
    (the variations are included as zip files in the plugins/iOS folder. Unzip the one you want to use)

    Default is: Fast and Small
     
    Last edited: Nov 15, 2014
  9. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    update 10/12/2014 version 1.2.5

    Added support for x86 Android builds. Changed the folder structure of the Plugins/Android folder. Now the plugins for each platform reside in their own folder named after the platform. You don't have to do anything. Unity will copy the correct lib for you wether you build for arm, x86 or both (fat binary).
     
  10. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    update 12/12/2014

    version 1.3 Added support for x86 and x86_64 Windows. A macOS version might come in the future. Removed crc checks on android and ios builds for faster extraction.
     
  11. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Hi, Im confused on what to do with this error:

    Assets/Plugins/lzma.cs(58,27): error CS0161: `lzma.doDecompress7zip(string, string, bool, bool, string)': not all code paths return a value

    Basically I'm trying to use your kit to replace a existing ZipCharpSDK as it does not work correctly for iOS. Its for saving and loading game.

    Thanks
     
  12. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi MrEsquire.

    Sorry for the trouble. This was introduced with more preprocessor commands added after the windows support.

    Just add these lines before the end of the doDecompress7zip function and you should be ok.

    Code (CSharp):
    1.         #if UNITY_IPHONE && UNITY_EDITOR
    2.             return -1;
    3.         #endif
    At some point a macos bundle will be added so it can work in the editor.
     
    Last edited: Jan 6, 2015
    MrEsquire likes this.
  13. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    update 22/01/2015 version 1.4

    Added OSX and Linux support.

    Blackberry and windows phone will follow.
     
  14. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    update 28/01/2015

    Experimental Blackberry support added.
     
  15. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    well be keeping an eye on this..
     
    MrEsquire likes this.
  16. aaronzh

    aaronzh

    Joined:
    Sep 24, 2014
    Posts:
    5
    to be most urgent!!!
    I used "lzma.doDecompress7zip" in android platform, but failed by error code "-1", I can make sure the 7z file exists, and the file path likes "jar:file:///data/app/xxx.apk!/assets/InstallAssetBundle/yyyy.7z".
    Is it something wrong in it?
    please answer me as soon as you could, thank you very much!
     
  17. kareljanvh

    kareljanvh

    Joined:
    Jan 29, 2015
    Posts:
    1
    Is it possible to add extracting progress as an event? We need it very urgently.

    thanks
     
  18. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    @aaronzh
    Hi the 7z plugin on Android, needs a real folder to work.
    It will not work on StreamingAssets. And it will not work with jar://...
    So if you have some 7z file in the apk, you should copy it first in Application.persistentDataPath,
    decompres and then delete the 7z file.
    For the same reason you cannot decompress files in Streaming Assets or Resources folder, because the apk is a zip actually.


    @kareljanvh

    (edited) I am looking at this right now and I believe in the next 1-2 days I will implement a solution.

    For now you can do this:
    - record somewhere the known uncompressed size of your file
    - call the plugin in a separate thread or coroutine
    - use System.FileInfo to get the file size of the file that is decompressing.
     
    Last edited: Jan 29, 2015
  19. aaronzh

    aaronzh

    Joined:
    Sep 24, 2014
    Posts:
    5
    tks for you reply!!!
    I got the reason, and has solved it by using the "WWW" of unity.
     
  20. aaronzh

    aaronzh

    Joined:
    Sep 24, 2014
    Posts:
    5
    BTW, we also need the process event, thank you again!
     
  21. aaronzh

    aaronzh

    Joined:
    Sep 24, 2014
    Posts:
    5
    hi, now the 7z module just can decompress a file to another file, so if we need decompress one file in jarfile on plarform android, it costs more time on IO process, because we need copy the compress data from jarfile to local space.
    Could you suppose to decompress the data of "byte[]" to a file or another byte array. so that we could use "WWW" of unity to get file data from jarfile, and decompress.
    thank you!
     
  22. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi. Some update news.

    The progress of decompression will take more time to get implemented. It is very complicated even to explain now. But still on the Radar.

    I have aded a function to get the filenames and the uncompressed file sizes of the archives in a 7z file.

    Basic encoding (compression) is getting added as we speak. I will look if it is possible to encode decode to byte buffers.
     
  23. aaronzh

    aaronzh

    Joined:
    Sep 24, 2014
    Posts:
    5
    thanks for your works,
    expecting more good news.
     
  24. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    update 03/02/2015 version 1.5
    Added the ability to get filename and file size information of a 7z archive.
    Added the ability to encode/decode to/from .lzma alone format.

    The 1.4.5 version is included also zipped in case somebody wants to use the basic functionality of the lib
    because the newer versions have grown in size.
     
  25. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    update 19/02/2015 version 1.5.5

    Added the ability to decode a specific file in a 7z archive to a byte buffer.
     
  26. lk1

    lk1

    Joined:
    Feb 28, 2015
    Posts:
    1
    Error building Player: IOException: Temp\StagingArea\libs\armeabi-v7a\liblzma.so already exists
     
  27. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Last edited: Feb 28, 2015
  28. alecli

    alecli

    Joined:
    Jul 22, 2014
    Posts:
    4
    When I upgrade to Unity5, i got these error:

    Plugin 'liblzma.so' is used from several locations:
    Assets/Plugins/Android/libs/armeabi-v7a/liblzma.so would be copied to <PluginPath>/liblzma.so
    Assets/Plugins/Android/libs/armeabi/liblzma.so would be copied to <PluginPath>/liblzma.so
    Assets/Plugins/x86/liblzma.so would be copied to <PluginPath>/liblzma.so
    Assets/Plugins/Android/libs/x86/liblzma.so would be copied to <PluginPath>/liblzma.so
    Please fix plugin settings and try again.

    What can i do? Thank You
     
  29. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi. Please make sure to move the Plugins folder directly under the Assets root, like: Assets/Plugins.

    Then it will work.

    This is stated in the documentation.

    The Plugins folder is in the Sevezip folder due to the functionality of the Asset store tools.
     
    Last edited: Mar 16, 2015
  30. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    For those having issues with unity5, it seems that unity5 does not respect the folder structure of the plugins.
    It can be a bug or by design, I don't know.

    But you can declare for each plugin its role as seen in the screenshot below.
    (the old armeabi plugin for android is no longer used, so delete it.)
    Untitled.jpg
     
  31. DarkCooker

    DarkCooker

    Joined:
    Jan 7, 2015
    Posts:
    95
    Hi
    We have tried it today and it crashed the editor with
    "Pointer being freed was not allocated"

    Any idea please? it is urgent...

    Thanks
    Billy
     
  32. YutakaKubota

    YutakaKubota

    Joined:
    Aug 11, 2014
    Posts:
    2
    this error occured for me too.
     
  33. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi. It works on my side. My OS is win7 64 bit.
    And I use the latest patch release for unity5.

    What OS have you?

    Also there is no point giving directly 1 star review on the asset store until the issue is investigated.
    The lib is battle tested in various situations.

    Does your 7z file use a password? Because passwords are not supported.

    In any case send me over PM the 7z file that has the issue.

    What language are you using?
     
    Last edited: Mar 18, 2015
  34. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi.

    You could first try to send a more detailed description of what happend.

    (Giving directly one star review in the asset store without a lot information, I don't know how it could help.)

    I tried on MacOSX withn unity3d 4.6.3p3 and it works ok.

    What language are you using?
     
    Last edited: Mar 18, 2015
  35. YutakaKubota

    YutakaKubota

    Joined:
    Aug 11, 2014
    Posts:
    2
    Thank you for response.

    It's my environment.

    Mac OS X Yosemite 10.10.2
    unity3d 4.6.3p3

    Please look screenshot.This is new project include only SevenZip.
     

    Attached Files:

  36. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi. For the plugin to work you must move your Plugins directory directly under the Assets folder.
    Like this: Assets/Plugins.

    This is in the documentation.

    This should solve your error.

    After the next update I will fix it so the user does not have to do this.
     
    Last edited: Mar 19, 2015
  37. suspectX

    suspectX

    Joined:
    Sep 23, 2014
    Posts:
    1
    Hi,I tried the "testScene",but change it to decompress my large file(doDecompress7zip) which is 200MB/600MB.And I have set the largeFiles flag to true.First time it decompress successfully,but the memory occupation is high,and I decompress it second time without closing my scene,the memory go more higher,after several times the unity crash.
    Is there any thing I need to know to release the memory after one decompress operation?
     
    Last edited: Apr 16, 2015
  38. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi.
    I am away right now but I will look into it at 21st April.
     
  39. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi again. I made more tests and there is no memory leak on the plugin side.

    Propably the large 7z file you are downloading is not getting cleaned from the memory.
    (I tried your file that you sent me also.)
     
  40. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    update 28/04/2015 version 1.5.7
    Adressed memory leak issues and changed the get7zInfo and get7zSize functions. It is recomended to use this version if you are calling the above functions on 7z archives that contain hundreds or thousands of files.

    (The memory leak issues were only in the get info functions.)
     
  41. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Some info from various usage cases.

    When the total uncompressed size of the archives in the 7z file is >2GB then it is recommended to use the non-solid compression method.

    See ideal settings in the screenshot below:

     
  42. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    update 16/05/2015

    version 1.5.8 Added ppmd decompression method support.
     
  43. BenQi

    BenQi

    Joined:
    Mar 18, 2013
    Posts:
    10
    i tried on il2cpp build on ios and 7z return error code got 2
     
  44. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi. error code 2 means "Could not find requested file in archive".
    That means you requested a specific file to get extracted from the 7z archive.
    If this file resides in a folder the whole path should be used to extract this file.

    Can you send me through pm the code you used or even the test project?

    Edit: I just made again an il2cpp test and it works as it should.
    Make sure that the selected file you want to extract has the full path like "a/b/c/someFile.dat"

    Otherwise send me the 7z file to look at.
     
    Last edited: May 29, 2015
  45. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    update 30/05/2015 version 1.6

    Major update:
    -Ability to compress a buffer to the lzma format and to decompres a buffer that is in the lzma format.

    -Added basic support for Windows Phone 8.1 and WSA plugins.

    -Added a method to get the current number of files extracted from a 7z archive. Provides a solution to get progress of decompression when the 7z archive has multiple files. (Currently does not work on linux and wp81/wsa.)

    - Fixed a bug in the Linux plugin where folders where not created correctly.

    More details in the documenation.
     
  46. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    186
    Hello,

    Is this like another version of asset bundles or what exactly ? didint quiet undrestand when to use it.
    Also is it compatible with webgl and webplayer ?

    Thanks
     
  47. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi. It is an autonomous native plugin that does 7zip decompression of 7z archives and compression/decompresion of lzma alone archives and buffers.

    It is 2.5x-3x faster then c# implementations.

    One of the main usages is to have compressed data downloaded or in the Resources folder and decompres them in the Application.persistantDataPath.
    Or to compress some buffers/files and send them to a server or to another application.

    It does not work with webgl and webplayer because it is a native plugin.

    Btw. it has now 50% price reduction in the 24h deals.
     
  48. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Announcement: since many users asked for .zip support, in the next update of the package, that will be in the next 10-14 days, .zip compression/decompresion will be added.
     
    Last edited: Jun 7, 2015
  49. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    84
    Could this plugin help me reduce .apk file size?
    Can I have a folder with sprites on a server, request them, and then use them on the game?
    I'm not familiar with either so excuse me if this question doesnt make sense:
    Besides the compression, whats the difference between this plugin and Unity asset bundles?
     
  50. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,247
    Hi.

    You could compress files in the resources or streaming assets folder and decompress them on the persistant data path. (you can do this either by copying the files to get decompressed first there and then delete them, or by decompressing lzma alone files to a buffer that have been requested through a www call. [www.bytes])

    Yes one of the main usages is to download a .7z or an .lzma file from a server and decompress it to persistant data path or to a buffer.
     
    fidelsoto likes this.
unityunity