@zodash/fs
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.0.11](https://github.com/zcorky/zodash/compare/@zodash/fs@0.0.10...@zodash/fs@0.0.11) (2021-04-18) | ||
**Note:** Version bump only for package @zodash/fs | ||
## [0.0.10](https://github.com/zcorky/zodash/compare/@zodash/fs@0.0.9...@zodash/fs@0.0.10) (2021-03-25) | ||
@@ -8,0 +16,0 @@ |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.download = void 0; | ||
function download(url, filename = `${Date.now()}`, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const response = yield fetch(url, { | ||
method: options === null || options === void 0 ? void 0 : options.method, | ||
headers: options === null || options === void 0 ? void 0 : options.headers, | ||
body: options === null || options === void 0 ? void 0 : options.body, | ||
}); | ||
const blob = yield response.blob(); | ||
const dataUrl = window.URL.createObjectURL(blob); | ||
const $link = document.createElement('a'); | ||
$link.style.display = 'none'; | ||
$link.href = dataUrl; | ||
$link.download = filename; | ||
document.body.appendChild($link); | ||
$link.click(); | ||
window.URL.revokeObjectURL(dataUrl); | ||
document.body.removeChild($link); | ||
async function download(url, filename = `${Date.now()}`, options) { | ||
const response = await fetch(url, { | ||
method: options === null || options === void 0 ? void 0 : options.method, | ||
headers: options === null || options === void 0 ? void 0 : options.headers, | ||
body: options === null || options === void 0 ? void 0 : options.body, | ||
}); | ||
const blob = await response.blob(); | ||
const dataUrl = window.URL.createObjectURL(blob); | ||
const $link = document.createElement('a'); | ||
$link.style.display = 'none'; | ||
$link.href = dataUrl; | ||
$link.download = filename; | ||
document.body.appendChild($link); | ||
$link.click(); | ||
window.URL.revokeObjectURL(dataUrl); | ||
document.body.removeChild($link); | ||
} | ||
exports.download = download; | ||
exports.default = download; | ||
//# sourceMappingURL=index.js.map |
@@ -12,1 +12,2 @@ "use strict"; | ||
exports.download = download_1.default; | ||
//# sourceMappingURL=index.js.map |
@@ -5,1 +5,2 @@ "use strict"; | ||
exports.default = load_css_1.loadCss; | ||
//# sourceMappingURL=index.js.map |
@@ -5,1 +5,2 @@ "use strict"; | ||
exports.default = load_image_1.loadImage; | ||
//# sourceMappingURL=index.js.map |
@@ -5,1 +5,2 @@ "use strict"; | ||
exports.default = load_js_1.loadJs; | ||
//# sourceMappingURL=index.js.map |
@@ -5,1 +5,2 @@ "use strict"; | ||
exports.default = jsonp_1.jsonp; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@zodash/fs", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "File Utils In Browser, loadJS / loadCSS / download", | ||
@@ -70,8 +70,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@zodash/download": "^0.0.1", | ||
"@zodash/jsonp": "^0.0.8", | ||
"@zodash/load-css": "^0.0.6", | ||
"@zodash/load-image": "^0.0.4", | ||
"@zodash/load-js": "^0.2.11" | ||
}, | ||
"gitHead": "bd85904bdf3094ed8d65df0fa57c695c74d4dc87" | ||
"@zodash/load-js": "^0.2.11", | ||
"@zodash/save-as": "^0.0.1" | ||
} | ||
} |
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
8231
21
6
69
+ Added@zodash/download@^0.0.1
+ Added@zodash/save-as@^0.0.1
+ Added@zodash/save-as@0.0.1(transitive)