careful-downloader
Advanced tools
Comparing version 1.0.1 to 1.1.0
14
index.js
@@ -12,2 +12,10 @@ import path from "path"; | ||
export default async function downloader(downloadUrl, checksumUrl, options) { | ||
options = options || {}; | ||
// don't delete the temp dir if set manually and dir exists | ||
let deleteTempDir = true; | ||
if (options.tempDir && fs.pathExistsSync(options.tempDir)) { | ||
deleteTempDir = false; | ||
} | ||
// normalize options and set defaults | ||
@@ -52,4 +60,6 @@ options = { | ||
} finally { | ||
// delete temporary directory | ||
await fs.remove(options.tempDir); | ||
// delete temporary directory (except for edge cases above) | ||
if (deleteTempDir) { | ||
await fs.remove(options.tempDir); | ||
} | ||
} | ||
@@ -56,0 +66,0 @@ } |
{ | ||
"name": "careful-downloader", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "🕵️♀️ Downloads a file and its checksums to a temporary directory, validates the hash, and optionally extracts it if safe.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -80,3 +80,3 @@ # 🕵️♀️ careful-downloader | ||
Path to temporary directory for unverified and/or unextracted downloads. Automatically generated if not set (recommended). | ||
Path to temporary directory for unverified and/or unextracted downloads. Automatically generated if not set (recommended). If set manually, the directory isn't purged upon finishing for security reasons. | ||
@@ -83,0 +83,0 @@ ##### destDir |
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
10889
131