Find file
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (46 sloc) 1.77 KB


A Zib library written in Dart.


This library is in progress, and can partially extract Zip files. To be more specific, it can extract non-compressed Zip files such as Zip files containing small text files (they are rarely compressed).


Add as a dependency to your pubspec.yaml. For example:

    git: git://

In the future when is launched, there will be a more direct way to do this.


Extracting an archive

The following code extracts the file to the given target folder. It works as long as the Zip file does not contain compressed files.

import 'package:dart_zip/zip.dart';
import 'dart:io';

void main() {
  var currentPath = new Directory.current().path;
  var zip = new Zip('');

  zip.extractTo(new Path.fromNative("${currentPath}/test-extraction/"));
Creating an archive

This code demonstrates how to dynamically add files to an archive and save it. Support for other actions will arrive at some point.

import 'package:dart_zip/zip.dart';
import 'dart:io';

void main() {
  var zip = new Zip('');
  zip.addFileFromString('something.txt', 'content goes here');;


  • No support for compression yet. Zips are stored without compression, and existing archives that are compressed can't be decompressed.
  • Encryption.
  • Signatures.
  • More API stuff.


I'm kind of waiting to see if Dart gets an official support for compression algorithms as they would perform much better that way.


The library is licensed under MIT. Feel free to use it for any purpose.