Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Rename arg to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed May 3, 2020
1 parent 7143e37 commit 23948ca
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ async function uploadFile (localPath, remotePath, uploadOptions = {}) {
/**
* Downloads the given file via HTTP(S)
*
* @param {string} url - The remote url
* @param {string} remoteUrl - The remote url
* @param {string} dstPath - The local path to download the file to
* @param {DownloadOptions} downloadOptions
* @param {?DownloadOptions} downloadOptions
* @throws {Error} If download operation fails
*/
async function downloadFile (url, dstPath, downloadOptions = {}) {
async function downloadFile (remoteUrl, dstPath, downloadOptions = {}) {
const {
isMetered = true,
auth,
Expand All @@ -103,7 +103,7 @@ async function downloadFile (url, dstPath, downloadOptions = {}) {
} = downloadOptions;

const requestOpts = {
url,
url: remoteUrl,
responseType: 'stream',
timeout,
};
Expand All @@ -130,15 +130,15 @@ async function downloadFile (url, dstPath, downloadOptions = {}) {
});
});
} catch (err) {
throw new Error(`Cannot download the file from ${url}: ${err.message}`);
throw new Error(`Cannot download the file from ${remoteUrl}: ${err.message}`);
}
if (!isMetered) {
return;
}

const secondsElapsed = timer.getDuration().asSeconds;
const {size} = await fs.stat(dstPath);
log.debug(`${url} (${toReadableSizeString(size)}) ` +
log.debug(`${remoteUrl} (${toReadableSizeString(size)}) ` +
`has been downloaded to '${dstPath}' in ${secondsElapsed.toFixed(3)}s`);
if (secondsElapsed >= 2) {
const bytesPerSec = Math.floor(size / secondsElapsed);
Expand Down

0 comments on commit 23948ca

Please sign in to comment.