Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

downloadjs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

downloadjs - npm Package Compare versions

Comparing version 1.4.4 to 1.4.6

LICENSE.md

17

download.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc