node-gmad
GMAD Extractor implemented in Node.js
Installation
npm install node-gmad
Usage
node-gmad makes use of the Q library to provide promises and callback support. You can call it either way, though examples will use promises.
var GMAD = ; GMAD;
Methods
parseAddon
parseAddon(filePath)
Parse and return the GMA file.
Options:
filePath (string): The path to the GMA file
extractFileFromAddon
extractFileFromAddon(basePath, gmaFile, fileIndex)
Extract a file from the GMA file
Options:
basePath (string): The base directory to extract the file
gmaFile (GMAFile): The parsed GMA file
fileIndex (int): The index of the file you wish to extract
GMAFile Structure
var { thisheader = "identifier": "" //Should always be GMAD "version": "" //Always 3 according to GMAD //Metadata thissteamId = ; //SteamId of the addon creator thistimestamp = ; //Unix timestamp thisunusedString = ""; //String data, presently unused thisname = ""; //Name of the Addon thisdescription = ""; //This may be JSON or a blurb containing bbcode thisauthor = ""; //Doesn't appear to be set properly, always "author" or "Author Name" thisversion = ""; //Addon version, GMAD states its not used right now //Filedata thisfileDataOffset = ; //Offset where file data starts thisfileList = ; //Array of GMAFileEntry}
GMAFileEntry Structure
var { thistitle = ""; //File path thissize = ; //Size of file thiscrc = ; //CRC of file thisoffset = ; //Offset indicating where file data starts thisfileNumber = 0; //Number in list @TODO Do we even need this?}
ExtractionStatus Structure
var { thissource = ""; //Source file thisdestination = ""; //Destination file thissuccess = false; //Whether extraction was successful thismessage = ""; //Message returned from extraction function thisstats = "bytesRead": 0 //Total bytes read from source file "bytesWritten": 0 //Total bytes writen to destination file }
Changelog
-
1.0.1 Add Readme
-
1.0.0 Initial Release