Skip to content
No description or website provided.
C++ JavaScript Makefile Python C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src
test
.editorconfig
.gitignore
.gitmodules
.jshintrc
LICENSE
Makefile
README.md
binding.gyp
package.json

README.md

mech-mpq

A StormLib MPQ wrapper for Node.js.

Installation

npm install mech-mpq --save

Example

Open an MPQ archive and read a file:

var mpq = require('mech-mpq');

function getFileContents(mpqPath, filePath) {
    var archive = mpq.openArchive(mpqPath);
    if (archive) {
        var file = archive.openFile(filePath);
        if (file) {
            var fileContents = file.read();
            file.close();
            return fileContents;
        }
    }
    return null;
}

var fileContents = getFileContents('./path/to/archive.mpq', 'filename.txt');
if (fileContents) {
    console.log(fileContents.length);
    console.log(fileContents);
}

See the tests for more examples.

Dev

Compilation

  1. Clone:
    • git clone https://github.com/mechanica/MPQ.git
  2. Checkout submodules:
    • git submodule init && git submodule update
  3. Build:
    • npm install
  4. Run tests:
    • npm test
Something went wrong with that request. Please try again.