Skip to content

Commit

Permalink
Updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisellgren committed Sep 26, 2012
1 parent efb0441 commit 70ccb2e
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,59 @@ such as Zip files containing small text files (they are rarely compressed).

### Installation

For now, until the Dart package manager is finished, just clone the repository.
Add as a dependency to your ```pubspec.yaml```. For example:

```
dependencies:
dart_zip:
git: git://github.com/kaisellgren/DartZip.git
```

In the future when http://pub.dartlang.org is launched, there will be a more direct way to do this.

### Examples

##### Extracting an archive

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

```dart
#import('../lib/Zip.dart');
#import('dart:io');
import 'package:dart_zip/zip.dart';
import 'dart:io';
void main() {
var currentPath = new Directory.current().path;
var zip = new Zip(new Path('test.zip'));
var zip = new Zip('test.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.

```dart
import 'package:dart_zip/zip.dart';
import 'dart:io';
void main() {
var zip = new Zip(test.zip');
zip.addFileFromString('something.txt', 'content goes here');
zip.save();
}
```

### TODO

Support for compressed files is the next priority. Even after that, there's still work to do regarding signatures, encryption and other minor things.
- 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.

### Notes

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

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

0 comments on commit 70ccb2e

Please sign in to comment.