草庐IT

javascript - 无法构造 'Blob' : The 1st argument provided is either null, 或无效的 Array 对象。

coder 2025-01-26 原文

我今天开始使用 filesaver.js。我创建了以下函数:

function saving(){
    var blob = new Blob(final_transformation, {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");
}

但是当我调用该函数时,我得到“无法构造‘Blob’:提供的第一个参数要么为空,要么为无效的 Array 对象。” 有什么想法吗?

最佳答案

由于您不会告诉我们 final_transformation 是什么,我们必须在没有上下文的情况下进行猜测。试试这个:

function saving(){
    var blob = new Blob([final_transformation], {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");
}

关于javascript - 无法构造 'Blob' : The 1st argument provided is either null, 或无效的 Array 对象。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28702799/

有关javascript - 无法构造 'Blob' : The 1st argument provided is either null, 或无效的 Array 对象。的更多相关文章

随机推荐