mirror of
https://github.com/jakejarvis/careful-downloader.git
synced 2025-04-26 13:28:27 -04:00
fix node 12.x
This commit is contained in:
parent
b75aef6e80
commit
3325d61b62
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -29,5 +29,4 @@ jobs:
|
|||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
- run: yarn audit
|
- run: yarn audit
|
||||||
- run: yarn lint
|
|
||||||
- run: yarn test
|
- run: yarn test
|
||||||
|
6
index.js
6
index.js
@ -11,13 +11,13 @@ import urlParse from "url-parse";
|
|||||||
export default async function downloader(downloadUrl, checksumUrl, options) {
|
export default async function downloader(downloadUrl, checksumUrl, options) {
|
||||||
// normalize options and set defaults
|
// normalize options and set defaults
|
||||||
options = {
|
options = {
|
||||||
filename: options.filename ?? urlParse(downloadUrl).pathname.split("/").pop(),
|
filename: options.filename || urlParse(downloadUrl).pathname.split("/").pop(),
|
||||||
extract: !!options.extract,
|
extract: !!options.extract,
|
||||||
tempDir: options.tempDir ? path.resolve(process.cwd(), options.tempDir) : tempy.directory(),
|
tempDir: options.tempDir ? path.resolve(process.cwd(), options.tempDir) : tempy.directory(),
|
||||||
destDir: options.destDir ? path.resolve(process.cwd(), options.destDir) : path.resolve(process.cwd(), "download"),
|
destDir: options.destDir ? path.resolve(process.cwd(), options.destDir) : path.resolve(process.cwd(), "download"),
|
||||||
cleanDestDir: !!options.cleanDestDir,
|
cleanDestDir: !!options.cleanDestDir,
|
||||||
algorithm: options.algorithm ?? "sha256",
|
algorithm: options.algorithm || "sha256",
|
||||||
encoding: options.encoding ?? "binary",
|
encoding: options.encoding || "binary",
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -21,8 +21,7 @@
|
|||||||
"index.d.ts"
|
"index.d.ts"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint .",
|
"test": "eslint . && mocha"
|
||||||
"test": "mocha"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"decompress": "^4.2.1",
|
"decompress": "^4.2.1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user