gulp-armapbo
Version:
The plugin for Gulp which allows to pack ArmA pbo files from sources.
25 lines (23 loc) • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const bufferAllocator_1 = require("./bufferAllocator");
const pboBodyWriter_1 = require("./pboBodyWriter");
const pboHeaderWriter_1 = require("./pboHeaderWriter");
const pboChecksumWriter_1 = require("./pboChecksumWriter");
const lzhReporter_1 = require("./lzh/lzhReporter");
class PboFormatter {
format(header, options) {
const buf = new bufferAllocator_1.BufferAllocator().allocateBuffers(header);
const bodySize = new pboBodyWriter_1.PboBodyWriter(options).writeBody(buf.body, header);
new pboHeaderWriter_1.PboHeaderWriter().writeHeader(buf.header, header);
const contents = Buffer.from(buf.raw, 0, buf.header.length + bodySize);
const signature = Buffer.from(buf.raw, contents.length, pboChecksumWriter_1.PboChecksumWriter.blockSize);
new pboChecksumWriter_1.PboChecksumWriter().writeChecksum(contents, signature);
const compressedLength = contents.length + pboChecksumWriter_1.PboChecksumWriter.blockSize;
const bytes = Buffer.from(buf.raw, 0, compressedLength);
new lzhReporter_1.LzhReporter(options).reportOverall(buf.raw.byteLength, compressedLength);
return bytes;
}
}
exports.PboFormatter = PboFormatter;
//# sourceMappingURL=pboFormatter.js.map