Comparing version 1.4.6 to 1.4.7
@@ -64,3 +64,3 @@ //download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage | ||
//go ahead and download dataURLs right away | ||
if(/^data\:[\w+\-]+\/[\w+\-\.]+[,;]/.test(payload)){ | ||
if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)){ | ||
@@ -67,0 +67,0 @@ if(payload.length > (1024*1024*1.999) && myBlob !== toString ){ |
@@ -1,2 +0,2 @@ | ||
//download.js v4.2, by dandavis; 2008-2016. [CCBY2] see http://danml.com/download.html for tests/usage | ||
(function(r,k){"function"==typeof define&&define.amd?define([],k):"object"==typeof exports?module.exports=k():r.download=k()})(this,function(){return function k(a,b,g){function q(p){var a=p.split(/[:;,]/);p=a[1];var a=("base64"==a[2]?atob:decodeURIComponent)(a.pop()),d=a.length,b=0,c=new Uint8Array(d);for(b;b<d;++b)c[b]=a.charCodeAt(b);return new f([c],{type:p})}function l(a,b){if("download"in d)return d.href=a,d.setAttribute("download",m),d.className="download-js-link",d.innerHTML="downloading...",d.style.display="none",document.body.appendChild(d),setTimeout(function(){d.click(),document.body.removeChild(d),!0===b&&setTimeout(function(){e.URL.revokeObjectURL(d.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return a=a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream"),!window.open(a)&&confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=a),!0;var c=document.createElement("iframe");document.body.appendChild(c),b||(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),c.src=a,setTimeout(function(){document.body.removeChild(c)},333)}var e=window,c=g||"application/octet-stream",h=!b&&!g&&a,d=document.createElement("a");g=function(a){return String(a)};var f=e.Blob||e.MozBlob||e.WebKitBlob||g,m=b||"download",f=f.call?f.bind(e):Blob;"true"===String(this)&&(a=[a,c],c=a[0],a=a[1]);if(h&&2048>h.length&&(m=h.split("/").pop().split("?")[0],d.href=h,-1!==d.href.indexOf(h))){var n=new XMLHttpRequest;return n.open("GET",h,!0),n.responseType="blob",n.onload=function(a){k(a.target.response,m,"application/octet-stream")},setTimeout(function(){n.send()},0),n}if(/^data\:[\w+\-]+\/[\w+\-]+[,;]/.test(a)){if(!(2096103.424<a.length&&f!==g))return navigator.msSaveBlob?navigator.msSaveBlob(q(a),m):l(a);a=q(a),c=a.type||"application/octet-stream"}b=a instanceof f?a:new f([a],{type:c});if(navigator.msSaveBlob)return navigator.msSaveBlob(b,m);if(e.URL)l(e.URL.createObjectURL(b),!0);else{if("string"==typeof b||b.constructor===g)try{return l("data:"+c+";base64,"+e.btoa(b))}catch(p){return l("data:"+c+","+encodeURIComponent(b))}c=new FileReader,c.onload=function(a){l(this.result)},c.readAsDataURL(b)}return!0}}); | ||
//download.js v4.2, by dandavis; 2008-2017. [MIT] see http://danml.com/download.html for tests/usage | ||
;(function(r,l){"function"==typeof define&&define.amd?define([],l):"object"==typeof exports?module.exports=l():r.download=l()})(this,function(){return function l(a,e,k){function q(a){var h=a.split(/[:;,]/);a=h[1];var h=("base64"==h[2]?atob:decodeURIComponent)(h.pop()),d=h.length,b=0,c=new Uint8Array(d);for(b;b<d;++b)c[b]=h.charCodeAt(b);return new f([c],{type:a})}function m(a,b){if("download"in d)return d.href=a,d.setAttribute("download",n),d.className="download-js-link",d.innerHTML="downloading...",d.style.display="none",document.body.appendChild(d),setTimeout(function(){d.click(),document.body.removeChild(d),!0===b&&setTimeout(function(){g.URL.revokeObjectURL(d.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(a)&&(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),!window.open(a)&&confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=a),!0;var c=document.createElement("iframe");document.body.appendChild(c),!b&&/^data:/.test(a)&&(a="data:"+a.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),c.src=a,setTimeout(function(){document.body.removeChild(c)},333)}var g=window,b=k||"application/octet-stream",c=!e&&!k&&a,d=document.createElement("a");k=function(a){return String(a)};var f=g.Blob||g.MozBlob||g.WebKitBlob||k,n=e||"download",f=f.call?f.bind(g):Blob;"true"===String(this)&&(a=[a,b],b=a[0],a=a[1]);if(c&&2048>c.length&&(n=c.split("/").pop().split("?")[0],d.href=c,-1!==d.href.indexOf(c))){var p=new XMLHttpRequest;return p.open("GET",c,!0),p.responseType="blob",p.onload=function(a){l(a.target.response,n,"application/octet-stream")},setTimeout(function(){p.send()},0),p}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(a)){if(!(2096103.424<a.length&&f!==k))return navigator.msSaveBlob?navigator.msSaveBlob(q(a),n):m(a);a=q(a),b=a.type||"application/octet-stream"}else if(/([\x80-\xff])/.test(a)){e=0;var c=new Uint8Array(a.length),t=c.length;for(e;e<t;++e)c[e]=a.charCodeAt(e);a=new f([c],{type:b})}a=a instanceof f?a:new f([a],{type:b});if(navigator.msSaveBlob)return navigator.msSaveBlob(a,n);if(g.URL)m(g.URL.createObjectURL(a),!0);else{if("string"==typeof a||a.constructor===k)try{return m("data:"+b+";base64,"+g.btoa(a))}catch(h){return m("data:"+b+","+encodeURIComponent(a))}b=new FileReader,b.onload=function(a){m(this.result)},b.readAsDataURL(a)}return!0}}); |
{ | ||
"name": "downloadjs", | ||
"main": "download.js", | ||
"version": "1.4.6", | ||
"version": "1.4.7", | ||
"description": "file downloading using client-side javascript", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -122,2 +122,3 @@ # download | ||
* 2016 :: 4.2 added large dataURL support, a more semantic codebase, and hidden temp links | ||
* 2017 :: added support for empty dataURLs | ||
* 20XX :: ???? Considering Zip, Tar, and other multi-file outputs, Blob.prototype.download option, and more, stay tuned folks. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16068
152
124