npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stormlib

v0.0.3

Published

NodeJS wrapper for StormLib

Downloads

33

Readme

JStormLib

NodeJS wrapper for StormLib. see(https://github.com/ladislav-zezula/StormLib).

I just use it to generate StarCraft1 maps, so no more options. Currently, just only working on windows.

Installation

You need to compile StormLib(ReleaseAS|x64) first.

You also need to install node-gyp(https://github.com/nodejs/node-gyp)

install Nan(https://github.com/nodejs/nan)

npm install

Build

node-gyp build

TODO

Support MacOSX, Linux

API

JStormLib.open

Open a MPQ archive, return a Promise.

JStormLib.open(filepath).then(arcive => {
    //archive.
}, err => {
    console.log(err)
});

JStormLib.create

Create a new MPQ archive.

JStormLib.create(filepath, flags, maxFileCount).then(arcive => {
    //archive.
}, err => {
    console.log(err)
});

|Name|Type|Description| |----|----|-----------| |filepath|string|Archive file name |flags|int|Additional flags to specify creation details. see CreateArchiveFlags |maxFileCount|int|Limit for file count

CreateArchiveFlags

Specifies additional flags for MPQ creation process. This parameter can be combination of the following flags:

|Value|Description| |-----|-----------| |0x00100000|The newly created archive will have (listfile) present.| |0x00200000|The newly created archive will have additional attributes in (attributes) file.| |0x00400000|The newly created archive will be signed with weak digital signature (the "(signature) file).| |0x00000000|The function creates a MPQ version 1.0 (up to 4 GB). This is the default value| |0x01000000|The function creates a MPQ version 2.0 (supports MPQ of size greater than 4 GB).| |0x02000000|The function creates a MPQ version 3.0 (introduced in WoW-Cataclysm Beta).| |0x03000000|The function creates a MPQ version 4.0 (used in WoW-Cataclysm).|

StormArchive.getLocale

JStormLib.open(filepath).then(arcive => {
    archive.getLocale();
}, err => {
    console.log(err)
});

Returns current locale ID for adding new files

StormArchive.setLocale

archive.setLocale(lcid);

Changes default locale ID for adding new files

what is LCID?

StormArchive.getFileList

archive.getFileList();
// ['a.txt', 'b.txt]

get a list of all files in the current archive

StormArchive.readFile

archive.readFile(filename).then(fileBuffer => {
    //save the buffer;
}, err => {
    console.log(err);
})

read file data by the specified file name.

StormArchive.writeFile

archive.writeFile(buffer, filename, lcid, flags, compression).then(fileBuffer => {
    //save the buffer;
}, err => {
    console.log(err);
})

writes data to the archive.

|Name|Type|Description| |----|----|-----------| |buffer|Buffer| data to be written| |filename|string| file name| |lcid|int|language Code Identifier| |flags|int|See WriteFileFlags | |compression|int|See Compression

WriteFileFlags

Specifies additional options about how to add the file to the MPQ. The value of this parameter can be a combination of the following values:

StarCraft1 Map(.scx, .scm) use 0x00010200

|Value|Description| |-----|-----------| |0x00000100|The file will be compressed using IMPLODE compression method. |0x00000200|The file will be compressed |0x00010000|The file will be stored as encrypted. |0x00020000|The file's encryption key will be adjusted according to file size in the archive. |0x02000000|The file will have the deletion marker. |0x04000000|The file will have CRC for each file sector. Ignored if the file is not compressed or if the file is stored as single unit. |0x01000000|The file will be added as single unit. Files stored as single unit cannot be encrypted, because Blizzard doesn't support them. |0x80000000|If this flag is specified and the file is already in the MPQ, it will be replaced.

WriteFileCompression

Compression method of the first file block. This parameter is ignored if MPQ_FILE_COMPRESS is not specified in dwFlags. This parameter can be a combination of the following values:

StarCraft1 Map(.scx, .scm) use 0x08

|Value|Description| |-----|-----------| |MPQ_COMPRESSION_HUFFMANN(0x01)|Use Huffman compression. This bit can only be combined with MPQ_COMPRESSION_ADPCM_MONO or MPQ_COMPRESSION_ADPCM_STEREO. |MPQ_COMPRESSION_ZLIB (0x02)|Use ZLIB compression library. This bit cannot be combined with MPQ_COMPRESSION_BZIP2 or MPQ_COMPRESSION_LZMA. |MPQ_COMPRESSION_PKWARE(0x08)|Use Pkware Data Compression Library. This bit cannot be combined with MPQ_COMPRESSION_LZMA. |MPQ_COMPRESSION_BZIP2(0x10)|Use BZIP2 compression library. This bit cannot be combined with MPQ_COMPRESSION_ZLIB or MPQ_COMPRESSION_LZMA. |MPQ_COMPRESSION_SPARSE(0x20)|Use SPARSE compression. This bit cannot be combined with MPQ_COMPRESSION_LZMA. |MPQ_COMPRESSION_ADPCM_MONO(0x40)|Use IMA ADPCM compression for 1-channel (mono) WAVE files. This bit can only be combined with MPQ_COMPRESSION_HUFFMANN. This is lossy compression and should only be used for compressing WAVE files. |MPQ_COMPRESSION_ADPCM_STEREO(0x80)|Use IMA ADPCM compression for 2-channel (stereo) WAVE files. This bit can only be combined with MPQ_COMPRESSION_HUFFMANN. This is lossy compression and should only be used for compressing WAVE files. |MPQ_COMPRESSION_LZMA(0x12)|Use LZMA compression. This value can not be combined with any other compression method.