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

careful-downloader

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

careful-downloader - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

24

index.js

@@ -12,6 +12,3 @@ import path from "path";

export default async function downloader(downloadUrl, checksumUrl, options) {
// intialize options if none are set
options = options || {};
export default async function downloader(downloadUrl, checksumUrl, options = {}) {
// normalize options and set defaults

@@ -72,8 +69,10 @@ options = {

async function downloadFile(url, dest) {
// get remote file and write locally
const pipeline = promisify(stream.pipeline);
return pipeline(
const download = await pipeline(
got.stream(url, { followRedirect: true }), // GitHub releases redirect to unpredictable URLs
fs.createWriteStream(dest),
);
return download;
}

@@ -83,2 +82,3 @@

async function checkChecksum(baseDir, downloadFile, checksumFile, algorithm, encoding) {
// instantiate checksum validator
const checker = new sumchecker.ChecksumValidator(algorithm, path.join(baseDir, checksumFile), {

@@ -88,3 +88,13 @@ defaultTextEncoding: encoding,

return checker.validate(baseDir, downloadFile);
// finally test the file
const valid = await checker.validate(baseDir, downloadFile);
return valid;
}
// eslint-disable-next-line no-unused-vars
async function wait(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
{
"name": "careful-downloader",
"version": "1.3.1",
"version": "1.3.2",
"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",

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