archive 1.0.0 icon indicating copy to clipboard operation
archive: ^1.0.0 copied to clipboard

outdatedDart 1 only

Provides encoders and decoders for various archive and compression formats, such as zip and tar.

#archive - Dart library to encode and decode various archive and compression formats.

The library has no reliance on dart:io, so it can be used for both server and web applications.

The archive library currently supports:

Decoders: Zip (Archive) Tar (Archive) ZLib (Compression) [Inflate decompression] GZip (Compression) [Inflate decompression]

Encoders: None yet. Adding Encoders is on my TODO.

Sample usage extract the contents of a Zip file:

import 'dart:io' as Io;
import 'package:archive/archive.dart';
main() {
  Io.File file = new Io.File('test.zip');
  file.openSync();
  var bytes = file.readAsBytesSync();
  if (bytes == null) {
    return;
  }

  var zip = new ZipDecoder(bytes);
  for (int i = 0; i < zip.numberOfFiles(); ++i) {
    String filename = zip.fileName(i);
    List<int> data = zip.fileData(i);
    Io.File fp = new Io.File('out/' + filename);
    fp.createSync(recursive: true);
    fp.writeAsBytesSync(data);
  }
}
437
likes
0
pub points
100%
popularity

Publisher

verified publisher iconloki3d.com

Provides encoders and decoders for various archive and compression formats, such as zip and tar.

Homepage

License

Icon for licenses.unknown (LICENSE)

Dependencies

unittest

More

Packages that depend on archive