106
rated 0 times
[
108]
[
2]
/ answers: 1 / hits: 47996
/ 10 Years ago, wed, january 14, 2015, 12:00:00
In my Ext Js solution I am calling a service which is returning this JSON format
{success:true,filename:spreadsheet.xlsx,file:[80,75,3,4,20,0,...(many more)]}
How can I make a file download dialog with the filename and the content of the byte array (file) ?
UPDATE
So I found this bit to start the downlaod
var a = window.document.createElement('a');
a.href = window.URL.createObjectURL(new Blob(data.file, { type: 'application/octet-stream' }));
a.download = data.filename;
// Append anchor to body.
document.body.appendChild(a)
a.click();
// Remove anchor from body
document.body.removeChild(a)
So far good
But the file I get is corrupted so I suspect I need to Encode/Decode the file variable?
More From » extjs3