Can't download ArrayBuffer
Closed this issue · 0 comments
chekoopa commented
Blob does support ArrayBuffer as a constructor argument, but when used on download()
, it returns just a same-lengthed stream of zeroes it does everything right.
UPD: Don't forget to use views to fill ArrayBuffers, like this:
var str= "hello world", arr= new ArrayBuffer(str.length); arr2=new Int8Array(arr);
str.split("").forEach(function(a,b){
arr2[b]=a.charCodeAt();
});
download( arr, "textArrayBuffer.txt", "text/plain" );
I'm closing the issue.