A Rust port of StormLib — a library for reading and writing MPQ (MoPaQ) archives, used by Blizzard Entertainment games.
- Read & Write: Full support for creating, reading, and modifying MPQ archives.
- Compression: Supports ZLIB, PKWARE (Implode), LZMA, Huffman, and ADPCM compression.
- Encryption: Supports file encryption and decryption.
- Patching: Support for incremental patching (BSDIFF40).
- Standard Compliance: Compatible with standard MPQ tools and specifications.
Add this to your Cargo.toml:
[dependencies]
storm-rs = { git = "https://github.com/phphackerr/storm-rs" }use storm_rs::MpqArchive;
let archive = MpqArchive::open("archive.mpq")?;
if archive.has_file("file.txt") {
let content = archive.read_file("file.txt")?;
println!("Content: {:?}", String::from_utf8_lossy(&content));
}use storm_rs::{MpqArchiveWriter, MpqCreateOptions, AddFileOptions, create_archive};
// Create empty archive
create_archive("new.mpq", &MpqCreateOptions::v1())?;
// Add files
let mut writer = MpqArchiveWriter::open("new.mpq")?;
writer.add_file("hello.txt", b"Hello World", &AddFileOptions::default())?;
writer.finish()?;Check the examples/ directory for more comprehensive usage:
create_archive.rs: Creating archives and adding files.read_archive.rs: Reading and extracting files.modify_archive.rs: Renaming, deleting, and updating files.patch_archive.rs: Applying incremental patches.
Run examples with:
cargo run --example create_archiveThis project is a Rust port of StormLib, originally developed by Ladislav Zezula. Without his extensive work on documenting and implementing the MPQ format, this project would not be possible.
This project is licensed under the MIT License - see the LICENSE file for details.