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;
}