diff --git a/.changeset/honest-bananas-doubt.md b/.changeset/honest-bananas-doubt.md new file mode 100644 index 0000000000..7b6be8e3eb --- /dev/null +++ b/.changeset/honest-bananas-doubt.md @@ -0,0 +1,5 @@ +--- +"@pnpm/tarball-fetcher": minor +--- + +Download progress should be logged only for big tarballs. diff --git a/packages/tarball-fetcher/src/createDownloader.ts b/packages/tarball-fetcher/src/createDownloader.ts index 294f85f27e..0b6415053b 100644 --- a/packages/tarball-fetcher/src/createDownloader.ts +++ b/packages/tarball-fetcher/src/createDownloader.ts @@ -12,6 +12,8 @@ import { BadTarballError } from './errorTypes' import urlLib = require('url') import ssri = require('ssri') +const BIG_TARBALL_SIZE = 1024 * 1024 * 5 // 5 MB + class TarballIntegrityError extends PnpmError { public readonly found: string public readonly expected: string @@ -149,7 +151,9 @@ export default ( if (opts.onStart) { opts.onStart(size, currentAttempt) } - const onProgress = opts.onProgress + // In order to reduce the amount of logs, we only report the download progress of big tarballs + const onProgress = size != null && size >= BIG_TARBALL_SIZE + ? opts.onProgress : undefined let downloaded = 0 res.body.on('data', (chunk: Buffer) => { downloaded += chunk.length