UNPKG

gulp-armapbo

Version:

The plugin for Gulp which allows to pack ArmA pbo files from sources.

21 lines (19 loc) 865 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const pboChecksumWriter_1 = require("./pboChecksumWriter"); const pboHeaderWriter_1 = require("./pboHeaderWriter"); class BufferAllocator { constructor() { this._headerWriter = new pboHeaderWriter_1.PboHeaderWriter(); } allocateBuffers(headerStruct) { const headerSize = this._headerWriter.measureHeader(headerStruct); const bodyMaxSize = this._headerWriter.measureBody(headerStruct); const raw = new ArrayBuffer(headerSize + bodyMaxSize + pboChecksumWriter_1.PboChecksumWriter.blockSize); const header = Buffer.from(raw, 0, headerSize); const body = Buffer.from(raw, headerSize, bodyMaxSize); return { header, body, raw }; } } exports.BufferAllocator = BufferAllocator; //# sourceMappingURL=bufferAllocator.js.map