🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

download-md5

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

download-md5

Download file utility, supports checking MD5 and finalize only when complete

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

download-md5

download-md5 is a simple utility to download files via HTTP, and optionally check their MD5 as it goes. It will download to a temporary file "next to" the final file, with an extension of .download. Once the file is completely downloaded, with no errors, then it will move the temporary file into place.

You can also call download-md5 from the command line, by installing it globally.

var download = require('download-md5')

var url = 'https://pbs.twimg.com/profile_images/616542814319415296/McCTpH_E.jpg'
download(url, 'results/grumpy_cat.jpg', { md5: 'dc3637149942510755db677cb1d1574e' }, function(err) {
  if (err)
    console.log(err)
  else
    console.log("Done")
})

Command line usage

Installation via npm:

 npm install download-md5 -g

Usage:

 download-md5 <from_url> <to_file> [md5]

download(from_url, to_file, [opts])

from_url is the URL to download from. It may be http or https, and may contain basic auth.

to_file is the output filename. The directory will be created using mkdirp if it does not exist.

opts is optional, and can have:

  • md5 - check the MD5 against a known MD5, and only consider the download successful if it matches
  • finalize - defaults to true. If set to false, then the output file will remain with the .download suffix. Call download.finalizeDownload(to_file, cb) to finish the job.
  • anything else is passed to request, e.g. timeout

License

ISC

Keywords

download

FAQs

Package last updated on 04 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts