Skip to content
pubscout

archive

4.7.1, released 7 days ago by taosengine.com

Encodes and decodes archive and compression formats such as zip, tar, gzip, and zlib.

WASM-readyRock solid
$ flutter pub add archive
Source repository

What it does

Provides encoders and decoders for various archive and compression formats. It handles reading and writing zip, tar, bzip2, gzip, zlib, xz, and zstd formats both in memory and via streaming.

AI-written summary of version 4.6.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to read or write zip and tar archives within a Dart or Flutter app.
  • You need to decompress or compress data using formats like GZip, ZLib, BZip2, XZ, or Zstandard.

Skip it when

  • You are running on the web platform and need to use InputFileStream for local file system access.

Strengths

  • Supports a wide variety of compression and archive formats.
  • Provides stream-based APIs and memory-efficient file streaming to minimize memory usage.

Weaknesses

  • File system operations like InputFileStream are not supported on the web platform.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2
import 'package:archive/archive.dart';
import 'dart:io';
void main() {
  final bytes = File('test.zip').readAsBytesSync();
  final archive = ZipDecoder().decodeBytes(bytes);
  for (final entry in archive) {
    if (entry.isFile) {
      final fileBytes = entry.content;
      File('out/${entry.name}')
        ..createSync(recursive: true)
        ..writeAsBytesSync(fileBytes);
    }
  }
}

Alternatives

Packages that do the same job and could replace archive.

  • gzip

    A lightweight package for gzip compression and decompression.

  • base32

    Base32 encoder and decoder for Dart, supporting multiple variants and OTP secrets.

  • brotli

    Pure Dart Brotli decoder

Works with

Packages commonly used together with archive: ones it builds on, ones built on it, and its own family.