"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeTar = void 0; const tar_js_1 = __importDefault(require("tar-js")); // converts a string to utf8 Uint8Array and returns it as a string-like // object that `tar.append` accepts as path function fixUnicodePath(path) { const codes = new TextEncoder().encode(path); return { length: codes.length, charCodeAt: index => codes[index], }; } function makeTar(data) { const tar = new tar_js_1.default(); for (const entry of data) { const path = fixUnicodePath(entry.path); tar.append(path, entry.data); } return tar.out; } exports.makeTar = makeTar;