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

fdownload

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fdownload - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

44

index.js

@@ -31,3 +31,5 @@ /**

function transfer_failed(e) {
function transfer_failed() {
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.event;
if (typeof opts.failed === "function") {

@@ -53,23 +55,25 @@ // console.log("An error occurred while transferring the file.");

xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var blob = xhr.response;
var reader = new FileReader();
reader.readAsDataURL(blob);
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var blob = xhr.response;
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload = function (e) {
var elink = document.createElement("a");
elink.download = fileName;
elink.style.display = "none";
elink.href = e.target.result;
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
reader.onload = function (e) {
var elink = document.createElement("a");
elink.download = fileName;
elink.style.display = "none";
elink.href = e.target.result;
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
if (typeof opts.complete === "function") {
// console.log("The transfer is complete.");
opts.complete(e);
}
};
} else {
opts.failed();
if (typeof opts.complete === "function") {
// console.log("The transfer is complete.");
opts.complete(e);
}
};
} else {
transfer_failed();
}
}

@@ -76,0 +80,0 @@ };

{
"name": "fdownload",
"version": "1.1.1",
"version": "1.1.2",
"description": "文件下载",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,5 +19,5 @@ /**

} else {
// console.log(
// "Unable to compute progress information since the total size is unknown"
// );
// console.log(
// "Unable to compute progress information since the total size is unknown"
// );
}

@@ -31,5 +31,5 @@ }

}
function transfer_failed(e) {
function transfer_failed(e=window.event) {
if (typeof opts.failed === "function") {
// console.log("An error occurred while transferring the file.");
// console.log("An error occurred while transferring the file.");
opts.failed(e);

@@ -40,3 +40,3 @@ }

if (typeof opts.canceled === "function") {
// console.log("The transfer has been canceled by the user.");
// console.log("The transfer has been canceled by the user.");
opts.canceled(e);

@@ -51,22 +51,23 @@ }

xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
const blob = xhr.response;
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload = function(e) {
const elink = document.createElement("a");
elink.download = fileName;
elink.style.display = "none";
elink.href = e.target.result;
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
if (typeof opts.complete === "function") {
// console.log("The transfer is complete.");
opts.complete(e);
}
};
}else{
opts.failed();
if (xhr.readyState == 4) {
if (xhr.status == 200) {
const blob = xhr.response;
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload = function(e) {
const elink = document.createElement("a");
elink.download = fileName;
elink.style.display = "none";
elink.href = e.target.result;
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
if (typeof opts.complete === "function") {
// console.log("The transfer is complete.");
opts.complete(e);
}
};
}else{
transfer_failed();
}
}

@@ -73,0 +74,0 @@ };

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