Skip to content

Instantly share code, notes, and snippets.

View wemersonjanuario's full-sized avatar

Wemerson Januario wemersonjanuario

View GitHub Profile
@rreimi
rreimi / saveas.js
Created December 1, 2014 17:29
Ajax blob save as.. file download
var url = 'http://www.pdf995.com/samples/pdf.pdf';
var fileName = '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);
@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);