3.3.4 unzipped file is empty
Closed this issue · 4 comments
yiiim commented
import 'dart:io';
import 'package:archive/archive_io.dart';
void main(List<String> args) async {
var zipPath = "./test.zip";
var encoder = ZipFileEncoder();
encoder.open(zipPath);
await encoder.addDirectory(Directory("./test"));
encoder.close();
final inputStream = InputFileStream("./test.zip");
final archive = ZipDecoder().decodeBuffer(inputStream);
for (var element in archive.files) {
if (element.isFile) {
final outputStream = OutputFileStream('./test_out/${element.name}');
element.writeContent(outputStream, freeMemory: false);
await outputStream.close();
}
}
await inputStream.close();
}
can work in 3.3.1
unzipped file is empty in 3.3.4
nasko25 commented
I am experiencing the same issue.
If I call file.content
before file.writeContent(outputStream)
it unzips and saves the file as expected.
juliansteenbakker commented
Issue is introduced in version 3.3.3.
version 3.3.2 seems to be working fine.
brendan-duncan commented
It turns out I had been sitting on the fix for this for a week. Sorry about that, work got busy. I published it in 3.3.5.
yiiim commented
@brendan-duncan thanks