-2
While trying to unzip a 500MB zip file using the package Archive, I’m having memory problems (Out of memory).
Follow the code for evaluation and suggestion of some alternative.
unarchiveAndSave(var zippedFile) async {
var bytes = zippedFile.readAsBytesSync();
var archive = ZipDecoder().decodeBytes(bytes);
for (var file in archive) {
var fileName = '$_dir/${file.name}';
if (file.isFile) {
var outFile = File(fileName);
print('File:: ${outFile.path}');
outFile = await outFile.create(recursive: true);
await outFile.writeAsBytes(file.content);
}
}
}
The system decompresses much of the file, however, at some point the return I have is that lost the connection with the emulator and other Out of memory.
Have you tried the physical device?
– rubStackOverflow
Yeah, same thing happens. As this was not working, I changed the approach a little and I’m using the package Cachednetworkplugin, which already makes even handling errors when I download the files on the Internet. Before the approach was to download a compressed file with all the photos, now I’m reading the photos directly from the site. Thank you
– Pablius Cardoso