Skip to content

Commit

Permalink
fix: fix option handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nknapp committed Jul 3, 2020
1 parent 52c48df commit 5fa9da6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ const { lookupAssets } = require("./lib/lookup-assets");
module.exports = { downloadChisel };

/**
* Download and
* @param semverRange
* @param tmpDir
* @return {Promise<*>}
* Download chisel for a given range of versions
* @param {string} semverRange
* @param {object=} userOptions
* @param {string=} userOptions.tmpDir
* @return {Promise<string>} the downloaded chisel executable
*/
async function downloadChisel(semverRange, { tmpDir = defaultTmpDir }) {
async function downloadChisel(semverRange, userOptions) {
const options = {
tmpDir: defaultTmpDir,
...userOptions,
};
const asset = lookupAssets(semverRange);
const zippedFileName = await downloadAndVerify(asset, tmpDir);
const zippedFileName = await downloadAndVerify(asset, options.tmpDir);
return await extractFile(zippedFileName);
}

Expand Down

0 comments on commit 5fa9da6

Please sign in to comment.