MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / progressEventReducer

Function progressEventReducer

out/cli.cjs:72673–72696  ·  view source on GitHub ↗
(listener, isDownloadStream, freq = 3)

Source from the content-addressed store, hash-verified

72671 }
72672 };
72673 const flush = () => lastArgs && invoke(lastArgs);
72674 return [throttled, flush];
72675}
72676var throttle_default = throttle;
72677
72678// node_modules/axios/lib/helpers/progressEventReducer.js
72679var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
72680 let bytesNotified = 0;
72681 const _speedometer = speedometer_default(50, 250);
72682 return throttle_default((e3) => {
72683 const loaded = e3.loaded;
72684 const total = e3.lengthComputable ? e3.total : void 0;
72685 const progressBytes = loaded - bytesNotified;
72686 const rate = _speedometer(progressBytes);
72687 const inRange = loaded <= total;
72688 bytesNotified = loaded;
72689 const data = {
72690 loaded,
72691 total,
72692 progress: total ? loaded / total : void 0,
72693 bytes: progressBytes,
72694 rate: rate ? rate : void 0,
72695 estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
72696 event: e3,
72697 lengthComputable: total != null,
72698 [isDownloadStream ? "download" : "upload"]: true
72699 };

Callers 1

cli.cjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected