A dart library for zip files / streams.

Features

Currently only the decompression function is supported.

  • Support for both AES and zip standard encryption methods
  • Support for Zip64 format
  • Store (No Compression) and Deflate compression method
  • Extract files from split zip files (Ex: z01, z02,...zip)

Usage

// Open a zip file and paras header.
final zipFile = await ZipFile.open(File('path'));

// Gat all file headers.
final headers = zipFile.fileHeaders;

// Get a zip entry source.
final entrySource = await zipFile.getEntrySource(headers.first);

// Zip entry source can be read into memory or saved to a file.
...

// Close resource
await entrySource?.close();
await zipFile.close();

Or use use and file_system:

final fileSystem = LocalFileSystem();
await ZipFile.open(fileSystem.file(file)).use((zip) async {
  for (final header in zip.fileHeaders) {
    await zip.getEntrySource(header).use((entrySource) async {
      if (entrySource == null) return;
      await fileSystem
          .openSink(join(output, header.fileName), recursive: true)
          .use((sink) => sink.buffer().writeSource(entrySource));
    });
  }
});

Libraries

anzip