fetch(getOurInfo.file_url)
.then(res => res.blob()).then((blob) => {
const a = document.createElement('a');
const url = window.URL.createObjectURL(blob);
a.href = url;
a.download = getOurInfo.file_name || 'Sumaten-introduction.pdf';
a.click();
window.open(url, '_blank');
window.URL.revokeObjectURL(url);
this.toastContainer.success(
<strong>{translations.validation_success}</strong>,
);
}).catch(err => this.toastServerErr(err));
````
Created
June 3, 2019 10:11
-
-
Save hungdev/1c20beb3d5f33295a7d3e671387b4439 to your computer and use it in GitHub Desktop.
download file with fetch
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment