UNPKG

@hap-toolkit/packager

Version:

@hap-toolkit/packager

3 lines (2 loc) 1.05 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"allocateResourceToPackages",{enumerable:!0,get:function(){return _service.allocateResourceToPackages}}),Object.defineProperty(exports,"createPackagesDefinition",{enumerable:!0,get:function(){return _service.createPackagesDefinition}}),exports.createZipBufferForPackage=createZipBufferForPackage;var _constant=require("../common/constant"),_ziputil=require("../common/ziputil"),_service=require("./service");async function createZipBufferForPackage(e){const t=e.resourceList,r={};t.forEach((e=>{const t=e.fileBuildPath;r[t]=e.fileContentDigest.toString("hex")}));const i=[{path:_constant.DIGEST_HASH_JSON,content:JSON.stringify({algorithm:"SHA-256",digests:r})}],a=await(0,_ziputil.createZipBufferFromFileList)(i),c=[];c.push({path:_constant.DIGEST_ZIP_PATH,content:a}),t.forEach((e=>{c.push({path:e.fileBuildPath,content:e.fileContentBuffer})}));return await(0,_ziputil.createZipBufferFromFileList)(c,e.comment)} //# sourceMappingURL=index.js.map