Comparing version 1.4.4 to 1.4.6
@@ -1,2 +0,2 @@ | ||
//download.js v4.2, by dandavis; 2008-2016. [CCBY2] see http://danml.com/download.html for tests/usage | ||
//download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage | ||
// v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime | ||
@@ -64,3 +64,3 @@ // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs | ||
//go ahead and download dataURLs right away | ||
if(/^data\:[\w+\-]+\/[\w+\-]+[,;]/.test(payload)){ | ||
if(/^data\:[\w+\-]+\/[\w+\-\.]+[,;]/.test(payload)){ | ||
@@ -76,4 +76,9 @@ if(payload.length > (1024*1024*1.999) && myBlob !== toString ){ | ||
}//end if dataURL passed? | ||
}else{//not data url, is it a string with special needs? | ||
if(/([\x80-\xff])/.test(payload)){ | ||
var i=0, tempUiArr= new Uint8Array(payload.length), mx=tempUiArr.length; | ||
for(i;i<mx;++i) tempUiArr[i]= payload.charCodeAt(i); | ||
payload=new myBlob([tempUiArr], {type: mimeType}); | ||
} | ||
} | ||
blob = payload instanceof myBlob ? | ||
@@ -117,3 +122,3 @@ payload : | ||
if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) { | ||
url=url.replace(/^data:([\w\/\-\+]+)/, defaultMime); | ||
if(/^data:/.test(url)) url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime); | ||
if(!window.open(url)){ // popup blocked, offer direct download: | ||
@@ -129,3 +134,3 @@ if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; } | ||
if(!winMode){ // force a mime that will download: | ||
if(!winMode && /^data:/.test(url)){ // force a mime that will download: | ||
url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime); | ||
@@ -132,0 +137,0 @@ } |
{ | ||
"name": "downloadjs", | ||
"main": "download.js", | ||
"version": "1.4.4", | ||
"version": "1.4.6", | ||
"description": "file downloading using client-side javascript", | ||
@@ -13,3 +13,3 @@ "keywords": [ | ||
"homepage": "http://danml.com/download.html", | ||
"license": "CC-BY-4.0", | ||
"license": "MIT", | ||
"author": { | ||
@@ -16,0 +16,0 @@ "name": "dandavis", |
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
151
15844