Closed qq1053831109 closed 3 years ago
Typically if you are talking about a standard map that wasn't optimized/protected, you can loop over all of the internal files, get their buffers, and from there you are free to do whatever you want.
E.g.:
for (let name of map.getFileNames()) {
let file = map.get(name);
let buffer = file.arrayBuffer(); // an ArrayBuffer
// Node
fs.appendFile(name, Buffer.from(buffer));
// Browser, e.g. file-saver on npm
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), name);
}
There's also getImportNames()
if you only care about imports.
If the map is a modified one and, for instance, it lacks a listfile, the above would probably miss all files (I admit I don't remember everything about the MPQ code since I wrote it ages ago). If this situation is relevant to you and you still want to extract everything, I can add something, or show you how to do it.
how can use War3Map make extract w3x file to a dir?