#blizzard #archive

bin+lib mpq

A library for reading MPQ archives

10 releases (breaking)

0.8.1 Aug 14, 2024
0.8.0 Sep 15, 2023
0.7.0 Sep 18, 2019
0.6.0 Apr 17, 2019
0.1.0 Sep 7, 2016

#128 in Compression

23 downloads per month

MIT/Apache

48KB
893 lines

mpq-rust Documentation

A library for reading MPQ archives.

# Cargo.toml
[dependencies]
mpq = "0.8"

Reading an archive

extern crate mpq;

use std::str;
use mpq::Archive;

fn main() {
    let mut a = Archive::open("common.MPQ").unwrap();
    let file = a.open_file("(listfile)").unwrap();

    let mut buf: Vec<u8> = vec![0; file.size(&a) as usize];

    file.read(&mut a, &mut buf).unwrap();

    print!("{}", str::from_utf8(&buf).unwrap());
}

CLI

Build

git clone https://github.com/msierks/mpq-rust.git && cd mpq-rust && cargo build --release

Run

print '(listfile)' contents:

target/release/mpq -l common.MPQ

extract file:

target/release/mpq -x "(listfile)" common.MPQ

More help:

target/release/mpq -h

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~2.5MB
~39K SLoC