js-file-downloader
Advanced tools
Comparing version 1.1.17 to 1.1.18
@@ -5,3 +5,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
else if(typeof define === 'function' && define.amd) | ||
define("jsFileDownloader", [], factory); | ||
define([], factory); | ||
else if(typeof exports === 'object') | ||
@@ -167,3 +167,3 @@ exports["jsFileDownloader"] = factory(); | ||
/*! | ||
* JS File Downloader v 1.1.17 | ||
* JS File Downloader v 1.1.18 | ||
* https://github.com/AleeeKoi/js-file-downloader | ||
@@ -379,4 +379,4 @@ * | ||
/******/ }); | ||
/******/ })["default"]; | ||
}); | ||
//# sourceMappingURL=js-file-downloader.js.map |
@@ -1,4 +0,4 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("jsFileDownloader",[],t):"object"==typeof exports?exports.jsFileDownloader=t():e.jsFileDownloader=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){var t="function"==typeof Map?new Map:void 0;return(i=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,c(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)})(e)}function a(e,t,n){return(a=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o}).apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.r(t);var l=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(i,e);var t,n,r=(t=i,n=u(),function(){var e,r=c(t);if(n){var i=c(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return o(this,e)});function i(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(n=r.call(this,"Downloader error: ".concat(e))).request=t,n.name="downloadException",n}return i}(i(Error)); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jsFileDownloader=t():e.jsFileDownloader=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){var t="function"==typeof Map?new Map:void 0;return(i=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,c(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)})(e)}function a(e,t,n){return(a=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o}).apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.r(t);var l=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(i,e);var t,n,r=(t=i,n=u(),function(){var e,r=c(t);if(n){var i=c(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return o(this,e)});function i(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(n=r.call(this,"Downloader error: ".concat(e))).request=t,n.name="downloadException",n}return i}(i(Error)); | ||
/*! | ||
* JS File Downloader v 1.1.17 | ||
* JS File Downloader v 1.1.18 | ||
* https://github.com/AleeeKoi/js-file-downloader | ||
@@ -10,3 +10,3 @@ * | ||
*/ | ||
function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var d={timeout:4e4,headers:[],forceDesktopMode:!1,autoStart:!0,withCredentials:!1,method:"GET",nameCallback:function(e){return e}},h=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f(this,e),this.params=Object.assign({},d,t),this.link=this.createLink(),this.request=null,this.params.autoStart?this.downloadFile():this}var t,n,r;return t=e,(n=[{key:"start",value:function(){return this.downloadFile()}},{key:"downloadFile",value:function(){var e=this;return new Promise((function(t,n){e.initDonwload(t,n)}))}},{key:"initDonwload",value:function(e,t){var n=this;return!("download"in this.link)||this.isMobile()?(this.link.target="_blank",this.link.href=this.params.url,this.clickLink(),e()):(this.request=this.createRequest(),this.params.url?(this.request.onload=function(){return 200!==parseInt(n.request.status,10)?t(new l("status code [".concat(n.request.status,"]"),n.request)):(n.startDownload(),e(n))},this.request.ontimeout=function(){t(new Error("Downloader error: request timeout"))},this.request.onerror=function(e){t(e)},this.request.send(),this):t("Downloader error: url param not defined!"))}},{key:"isMobile",value:function(){return!this.params.forceDesktopMode&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}},{key:"createRequest",value:function(){var e=new XMLHttpRequest;return e.open(this.params.method,this.params.url,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),this.params.headers.forEach((function(t){e.setRequestHeader(t.name,t.value)})),e.responseType="arraybuffer",this.params.process&&"function"==typeof this.params.process&&e.addEventListener("progress",this.params.process),e.timeout=this.params.timeout,e.withCredentials=!!this.params.withCredentials||!!this.params.includeCredentials,e}},{key:"getFileName",value:function(){if("string"==typeof this.params.filename)return this.params.filename;var e=this.request.getResponseHeader("Content-Disposition"),t=[];e&&(t=e.replace(/["']/g,"").match(/filename\*?=([^;]+)/));var n=t&&t.length>=1?t[1]:this.params.url.split("/").pop().split("?")[0];return this.params.nameCallback(n)}},{key:"createLink",value:function(){var e=document.createElement("a");return e.style.display="none",e}},{key:"clickLink",value:function(){var e;try{e=new MouseEvent("click")}catch(t){(e=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}this.link.dispatchEvent(e)}},{key:"getFile",value:function(e,t){var n=null,r={type:"application/octet-stream"};try{n=new File([e],t,r)}catch(o){(n=new Blob([e],r)).name=t,n.lastModifiedDate=new Date}return n}},{key:"startDownload",value:function(){var e=this.getFileName(),t=this.getFile(this.request.response,e);if("msSaveOrOpenBlob"in window.navigator)return window.navigator.msSaveOrOpenBlob(t,e);var n=window.URL.createObjectURL(t);return this.link.href=n,this.link.download=e,this.clickLink(),setTimeout((function(){(window.URL||window.webkitURL||window).revokeObjectURL(n)}),4e4),this}}])&&p(t.prototype,n),r&&p(t,r),e}();t.default=h}])})); | ||
function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var d={timeout:4e4,headers:[],forceDesktopMode:!1,autoStart:!0,withCredentials:!1,method:"GET",nameCallback:function(e){return e}},h=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f(this,e),this.params=Object.assign({},d,t),this.link=this.createLink(),this.request=null,this.params.autoStart?this.downloadFile():this}var t,n,r;return t=e,(n=[{key:"start",value:function(){return this.downloadFile()}},{key:"downloadFile",value:function(){var e=this;return new Promise((function(t,n){e.initDonwload(t,n)}))}},{key:"initDonwload",value:function(e,t){var n=this;return!("download"in this.link)||this.isMobile()?(this.link.target="_blank",this.link.href=this.params.url,this.clickLink(),e()):(this.request=this.createRequest(),this.params.url?(this.request.onload=function(){return 200!==parseInt(n.request.status,10)?t(new l("status code [".concat(n.request.status,"]"),n.request)):(n.startDownload(),e(n))},this.request.ontimeout=function(){t(new Error("Downloader error: request timeout"))},this.request.onerror=function(e){t(e)},this.request.send(),this):t("Downloader error: url param not defined!"))}},{key:"isMobile",value:function(){return!this.params.forceDesktopMode&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}},{key:"createRequest",value:function(){var e=new XMLHttpRequest;return e.open(this.params.method,this.params.url,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),this.params.headers.forEach((function(t){e.setRequestHeader(t.name,t.value)})),e.responseType="arraybuffer",this.params.process&&"function"==typeof this.params.process&&e.addEventListener("progress",this.params.process),e.timeout=this.params.timeout,e.withCredentials=!!this.params.withCredentials||!!this.params.includeCredentials,e}},{key:"getFileName",value:function(){if("string"==typeof this.params.filename)return this.params.filename;var e=this.request.getResponseHeader("Content-Disposition"),t=[];e&&(t=e.replace(/["']/g,"").match(/filename\*?=([^;]+)/));var n=t&&t.length>=1?t[1]:this.params.url.split("/").pop().split("?")[0];return this.params.nameCallback(n)}},{key:"createLink",value:function(){var e=document.createElement("a");return e.style.display="none",e}},{key:"clickLink",value:function(){var e;try{e=new MouseEvent("click")}catch(t){(e=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}this.link.dispatchEvent(e)}},{key:"getFile",value:function(e,t){var n=null,r={type:"application/octet-stream"};try{n=new File([e],t,r)}catch(o){(n=new Blob([e],r)).name=t,n.lastModifiedDate=new Date}return n}},{key:"startDownload",value:function(){var e=this.getFileName(),t=this.getFile(this.request.response,e);if("msSaveOrOpenBlob"in window.navigator)return window.navigator.msSaveOrOpenBlob(t,e);var n=window.URL.createObjectURL(t);return this.link.href=n,this.link.download=e,this.clickLink(),setTimeout((function(){(window.URL||window.webkitURL||window).revokeObjectURL(n)}),4e4),this}}])&&p(t.prototype,n),r&&p(t,r),e}();t.default=h}]).default})); | ||
//# sourceMappingURL=js-file-downloader.min.js.map |
{ | ||
"name": "js-file-downloader", | ||
"version": "1.1.17", | ||
"version": "1.1.18", | ||
"description": "Small lib for a cool download experience", | ||
@@ -5,0 +5,0 @@ "main": "dist/js-file-downloader.js", |
@@ -29,3 +29,3 @@ const path = require('path'); | ||
libraryTarget: 'umd', | ||
umdNamedDefine: true, | ||
libraryExport: 'default', | ||
globalObject: 'this' | ||
@@ -32,0 +32,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
84977