zlib.httpFile.verifiedZip.extract(url, sha256, extractDir, options) 是调用者明确需要SHA256校验时的可选工具。普通下载继续使用 zlib.httpFile.download,无须迁移到本入口。
import zlib.httpFile.verifiedZip;
var r,err,kind=zlib.httpFile.verifiedZip.extract(
"https://example.com/tool.zip",string.repeat(64,"0"),"/stage-new",{
archivePath="/cache/tool.zip";
rootName="tool";
});
return {result=r;error=err;kind=kind};
示例URL/hash是占位值。真实调用者自行提供所需摘要。
.part,核对一次SHA256再转缓存;已有缓存核对一次。不是安装文件hash清单,也不限制产品之后升级。archivePath、单层 rootName 必填;将该根目录内容直接解到新的 extractDir。finalDir 可选,用于提前报告目标路径过长。stop()、onProgress(received,total) 可选,失败关闭资源。成功 {dir;archivePath;sha256;files;bytes},失败 null,err,kind;部分解压目录由调用者清理。面向可信产品归档,不是任意不可信ZIP的沙箱;不还原权限、链接或时间属性。