系统配置:macOS Sierra 10.12.5; 铬60;
我试图将JSON数据(响应对象)作为json文件下载,但是当我尝试使用浏览器File()对象实现此目的时,它会出错
Failed to construct 'File': Iterator getter is not callable.
下面是我的代码
//`inputData` is the valid response getting from $http.get
var stringifyData = JSON.stringify(inputData);
console.log("stringifyData ", stringifyData);
var file = new File(blob, "filename.json", {type: "text/json;charset=utf-8"});
console.log("file", file);
Run Code Online (Sandbox Code Playgroud)
问题是什么以及我收到此错误的原因.当我使用JSON.stringify(inputData, undefined, 4);它然后它没有给出错误并在控制台中显示正确的对象.