Git Product home page Git Product logo

dartzip's Introduction

DartZip

A Zib library written in Dart.

Notes

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).

Installation

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

dependencies:
  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.

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

void main() {
  var currentPath = new Directory.current().path;
  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.

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

  • 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.

dartzip's People

Contributors

kaisellgren avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.