gpt4 book ai didi

javascript - JSZip 文件无法工作 :"' 错误 : The data of 'the loaded zip file' is in an unsupported format ! "

转载 作者:行者123 更新时间:2023-11-28 04:03:53 25 4
gpt4 key购买 nike

出现此错误消息:

"Error: The data of 'the loaded zip file' is in an unsupported format !".

我使用的是 Google Chrome - 最新版本。

这是代码的粘贴箱:https://pastebin.com/svFjr2Jq (对于 stackoverflow 来说太长了)。

您可以在此处查看模板:

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
(jszip)
</script>
</head>
<body>
Loading...<br />
<progress id="pBar"></progress>
<script>
var pBar = document.getElementById('pBar');
var content = atob('(base64 zip)');
var zipFile = new JSZip();
main();
async function loadFile(toLoad, base64) {{
return await zipFile.file(toLoad + (base64 ? ".txt" : "")).async(base64 ? "text" : "base64");
}}
async function loadScript(toLoad) {{
var content = await loadFile(toLoad, false);
var script = document.createElement('script');
script.src = 'data:text/javascript;base64,' + v;
document.head.appendChild(script);
await new Promise(callback => script.onload = callback);
}}
async function main()
{{
await zipFile.loadAsync(content);
var content = await zipFile.file('load.txt').async("string");
var files = arg0.replace(/\r/g, '').split('\n');
pBar.max = files.length;
for (var fileName of files)
{{
(pBar ? pBar.value++ : void 0);
await loadScript(fileName);
}}
}}
</script>
</body>
</html>

最佳答案

也许您应该在使用 loadAsync() 时返回 Promise。请参阅文档以更好地理解:https://stuk.github.io/jszip/documentation/api_jszip/load_async.html

关于javascript - JSZip 文件无法工作 :"' 错误 : The data of 'the loaded zip file' is in an unsupported format ! ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46866277/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com