Extract a zip file from a zip archive without loading the entire file into memory

Is there a way to extract a single file from a zip file in Adobe AIR?

I am using the NoChumps zip library to extract files from zip. In this library, the entire IDataStream file is loaded into memory, after which you can easily extract records from the file. In cases where the zip is from 5 to 10 MB, there are no problems. But when the zip code is 80 MB, and many of them, 80 MB is loaded into memory. This causes the application to crash and work on mobile devices. According to the zip specification,

"The ZIP file is identified by the presence of a central directory located at the end of the file, which allows you to add new files. The directory stores a list of record names (files or directories) stored in the ZIP file, as well as other metadata about the record and the offset to the ZIP file, indicating the actual input data. "

In addition, I have no control over the size of zip files, but in most cases from 60 to 100 MB. Files inside - ~ 4 MB.

+4
source share
2 answers

This is not possible for Flex, but it is possible for AIR. AIR received a class of files with random access, which allows you to read a list of zip files. I used Coltware airxzip and it served me well. Create a ZipFileReader , open your zip file, call getEntries() , find the entry you need and call reader.unzip(entry) .

+2
source

The quick answer is no, this is not possible.

The long answer is that you need to make a secondary program using the zLib library and install it on your computer as well

+1
source

Source: https://habr.com/ru/post/1343239/


All Articles