0.1.0 • Published 9 years ago

diablo-file-formats v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

diablo-file-formats

Handles parsing of binary files found within Diablo 1 MPQ archives, and the creation of convenient run-time data structures.

Currently supported file formats:

  • .cel
  • .cl2 (partial)
  • .pal
  • .dun
  • .til
  • .min
  • .sol

Installation

npm install diablo-file-formats

Usage

// 1). Require the package.
var DFormats = require('diablo-file-formats');

// 2). Read the file.
var path = 'levels/towndata/town.pal';
fs.readFile(path, function read(err, buffer) {
    // 3). Parse the file.
    var palFile = DFormats.Pal.load(buffer, path);
    
    // 4). Do something with the file.
    for (var i = 0; i < palFile.colors; i++) {
        console.log(palFile.colors[i]);
    }
});

Protip

Use along with MPQ readers like mech-mpq or mpq-server to dynamically extract and parse the MPQ archive (without having to pre-extract the contents).

Acknowledgments

Special thanks to @mewmew for the blizzconv project, which served as an invaluable reference.