1
mirror of https://github.com/jakejarvis/careful-downloader.git synced 2025-04-26 06:35:22 -04:00

Update README

This commit is contained in:
Jake Jarvis 2021-10-16 06:15:30 -04:00
parent 4d3134afb8
commit 249b0605f0
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39

View File

@ -23,7 +23,7 @@ await downloader(
"https://github.com/gohugoio/hugo/releases/download/v0.88.1/hugo_extended_0.88.1_Windows-64bit.zip", "https://github.com/gohugoio/hugo/releases/download/v0.88.1/hugo_extended_0.88.1_Windows-64bit.zip",
{ {
checksumUrl: "https://github.com/gohugoio/hugo/releases/download/v0.88.1/hugo_0.88.1_checksums.txt", checksumUrl: "https://github.com/gohugoio/hugo/releases/download/v0.88.1/hugo_0.88.1_checksums.txt",
destDir: "./vendor", destDir: "vendor", // relative to process.cwd()
algorithm: "sha256", algorithm: "sha256",
extract: true, extract: true,
}, },
@ -31,16 +31,18 @@ await downloader(
//=> '/Users/jake/src/carefully-downloaded/vendor/hugo.exe' //=> '/Users/jake/src/carefully-downloaded/vendor/hugo.exe'
``` ```
Instead of `options.checksumUrl`, you can also simply provide a hash as a string via `options.checksumHash`. Instead of a `checksumUrl`, you can also simply provide a hash as a string via `checksumHash`:
```js ```js
import downloader from "careful-downloader";
await downloader( await downloader(
"https://github.com/gohugoio/hugo/releases/download/v0.88.1/hugo_extended_0.88.1_Windows-64bit.zip", "https://github.com/gohugoio/hugo/releases/download/v0.88.1/hugo_extended_0.88.1_Windows-64bit.zip",
{ {
checksumHash: "aaa20e258cd668cff66400d365d73ddc375e44487692d49a5285b56330f6e6b2", checksumHash: "aaa20e258cd668cff66400d365d73ddc375e44487692d49a5285b56330f6e6b2",
destDir: "./vendor", destDir: "vendor",
algorithm: "sha256", algorithm: "sha256",
extract: false, // default extract: false, // the default
}, },
); );
//=> '/Users/jake/src/carefully-downloaded/vendor/hugo_extended_0.88.1_Windows-64bit.zip' //=> '/Users/jake/src/carefully-downloaded/vendor/hugo_extended_0.88.1_Windows-64bit.zip'