digitalmars.D.learn - std.zip and a large archive
- AntonSotov (16/16) Jul 19 2014 I process archive:
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (14/30) Jul 19 2014 Hmm... it's unfortunate that ZipArchive doesn't take a file
- AntonSotov (3/5) Jul 19 2014 auto mmfile = new MmFile("c:/test.zip");
- bearophile (4/15) Jul 19 2014 This could be added to the ZipArchive online docs.
- Domingo Alvarez Duarte (3/3) Jul 19 2014 It seems that ti only works for zip files with less than 65000
- Domingo Alvarez Duarte (3/3) Jul 19 2014 It seems that this only works for zip files with less than 65000
I process archive: /////////////// import std.stdio, std.zip, std.file; int main() { auto zip = new ZipArchive(read("c:/test.zip")); foreach (item; zip.directory) { writeln("processing ", item.name, " ..."); // processing item... } return 0; } ///////////////// it works well for normal archives. but how to process zip archive ~1GB ? it takes a long of RAM.
Jul 19 2014
On Saturday, 19 July 2014 at 07:55:10 UTC, AntonSotov wrote:I process archive: /////////////// import std.stdio, std.zip, std.file; int main() { auto zip = new ZipArchive(read("c:/test.zip")); foreach (item; zip.directory) { writeln("processing ", item.name, " ..."); // processing item... } return 0; } ///////////////// it works well for normal archives. but how to process zip archive ~1GB ? it takes a long of RAM.Hmm... it's unfortunate that ZipArchive doesn't take a file descriptor. As a workaround, you can use memory mapping: import std.stdio, std.zip, std.file, std.mmfile; int main() { auto mmfile = new MmFile(File("c:/test.zip", "rb")); auto zip = new ZipArchive(mmfile[]); foreach (item; zip.directory) { writeln("processing ", item.name, " ..."); // processing item... } return 0; }
Jul 19 2014
On Saturday, 19 July 2014 at 10:46:31 UTC, Marc Schütz wrote:Hmm... it's unfortunate that ZipArchive doesn't take a file descriptor. As a workaround, you can use memory mapping:auto mmfile = new MmFile("c:/test.zip"); Thank you. it works!
Jul 19 2014
Marc Schütz:import std.stdio, std.zip, std.file, std.mmfile; int main() { auto mmfile = new MmFile(File("c:/test.zip", "rb")); auto zip = new ZipArchive(mmfile[]); foreach (item; zip.directory) { writeln("processing ", item.name, " ..."); // processing item... } return 0; }This could be added to the ZipArchive online docs. Bye, bearophile
Jul 19 2014
It seems that ti only works for zip files with less than 65000 entries, zip64 that allow read more than that do seem to be implemented.
Jul 19 2014
It seems that this only works for zip files with less than 65000 entries, zip64 that allow read more than that do not seem to be implemented.
Jul 19 2014