Skip to content

Instantly share code, notes, and snippets.

View jgab-net's full-sized avatar
🔥
On fire

Abraham J Gonzalez B jgab-net

🔥
On fire
View GitHub Profile
@jgab-net
jgab-net / blob.js
Last active March 22, 2019 13:17
Download file with xhr2 [blob url & html5 file api]
var url = 'http://backend.siplik.co/public/word-to-pdf.pdf';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.onprogress = function(pe) {
console.log('progress');
if (pe.lengthComputable) {
console.log((pe.loaded / pe.total) * 100);