Skip to content

w3gh/node-mpq

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  1. Checkout submodules:
  • git submodule init && git submodule update
  1. Build:
  • npm install
  1. Run tests:
  • npm test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 63.8%
  • JavaScript 29.6%
  • Makefile 2.7%
  • Python 2.5%
  • C 1.4%