fetch download blob file
try {
fetch(URL + 'download_estudiante_excel', {
method: 'GET',
headers: {
'Content-Type': '\tapplication/vnd.ms-excel',
'Authorization': 'Bearer ' + sessionStorage.getItem('token')
},
}).then(
data => {
return data.blob();
}
).then(
response => {
console.log(response.type);
const dataType = response.type;
const binaryData = [];
binaryData.push(response);
const downloadLink = document.createElement('a');
downloadLink.href = window.URL.createObjectURL(new Blob(binaryData, { type: dataType }));
downloadLink.setAttribute('download', 'report');
document.body.appendChild(downloadLink);
downloadLink.click();
downloadLink.remove();
}
)
} catch (e) {
addToast('Error inesperado.', {appearance: 'error', autoDismiss: true});
}
Also in JavaScript:
- react native button round
- str_word_count php js
- angular clone array without reference
- how to remove an object from array in react native
- heroku failed to run files from static folder in node
- how to make a javascript game
- jquery autocomplete database
- if else render react
- js standard global
- javascript int values
- reqeuest body in hapijs
- angular An accessor cannot be declared in an ambient context.
- check browser locale javascript
- js loop trough map
- Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number.
- JavaScript Operators
- discord.js MessageEmbed
- node check if file exists
- javascript jqgrid events afterShowForm
- js get file name from path
- call laravel route js
- remove property mongodb
- how to execute something after ajax call
- nodejs fs delete non empty directory