rapid_archive_io library

File and folder helpers that work with constant memory, like package:archive's archive_io.dart. Not available on web.

// import 'package:archive/archive_io.dart';
import 'package:rapid_archive/rapid_archive_io.dart';

await extractFileToDisk('photos.zip', 'out/photos');
await ZipFileEncoder().zipDirectory(Directory('out/photos'));

Every function runs in a background isolate, so it never blocks the UI, and the work itself runs on every CPU core where it can. Memory use does not depend on the file size: zips over 4 GB (zip64) and gzip files of any size are fine.

Classes

Archive
/ A collection of files
ArchiveFile
A file contained in an Archive.
GZipDecoder
gzip decompression. Concatenated gzip members are decoded like gunzip.
GZipEncoder
gzip compression. Same API as package:archive's GZipEncoder.
ZipDecoder
Reads zip files. Every entry is extracted (in parallel) during decodeBytes; each file's content is a zero-copy view into one native buffer.
ZipEncoder
Builds zip files, compressing entries in parallel on every core.
ZipFileEncoder
Writes zip files from folders on disk.
ZLibDecoder
zlib (RFC 1950) decompression; raw: true for bare deflate.
ZLibEncoder
zlib (RFC 1950) compression.

Enums

CompressionType
The format of the compression an ArchiveFile is stored with.

Functions

ensureRapidArchiveInitialized() → Future<void>
Prepares the library. On web this compiles the WebAssembly module, so call and await it once at startup (for example in main()). On every other platform it returns immediately.
extractFileToDisk(String inputPath, String outputPath) → Future<void>
Extracts the zip file at inputPath into the folder outputPath (created if needed). Entries are written in parallel; large entries are streamed. Every CRC is checked, and entries whose names would land outside outputPath ("zip slip") are refused.
gunzipFile(String input, String output) → Future<int>
Decompresses the gzip file at input to output. Returns the number of bytes written. Concatenated members are decoded like gunzip.
gzipFile(String input, String output, {int? level, bool parallel = true}) → Future<void>
Compresses the file at input to the gzip file output. With parallel (the default), it uses every core; the output is one standard gzip stream.

Exceptions / Errors

RapidArchiveException
Thrown when the Rust core rejects input (corrupt data, zip bomb, ...).