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
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.
Works with
Packages commonly used together with archive: ones it builds on, ones built on it, and its own family.
- posixarchive depends on itExposes the POSIX api on OSx and Linux via an idiomatic Dart API.
- imageBuilt on archivePure Dart library to load, manipulate, encode, and decode various image formats.
- lottieBuilt on archiveRender After Effects JSON animations natively in Flutter.
- pdfBuilt on archiveA PDF generation library for Dart and Flutter using a widget-like layout system.
- unicodeBuilt on archiveLibrary providing Unicode character utilities and emoji data generated from Unicode 17.0.0
- masonBuilt on archiveDart template generator for quick file creation
- tostoreBuilt on archiveLocal data engine providing key-value, SQL/NoSQL tables, vector embeddings, and hybrid text search.
- pdfrx_engineBuilt on archivePure Dart PDF rendering and manipulation API built on top of PDFium.