For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /reference/sdk/logs/functions/bindByteProgressToBar.md.
  • 简体中文
  • Function: bindByteProgressToBar()

    function bindByteProgressToBar(bar: ProgressHandle, opts?: DownloadProgressBinderOptions): (downloaded: number, total: number) => void;

    Defined in: logs/terminal-progress.ts:131

    把字节进度接到 TerminalProgress(MB 刻度 + 速度文案)。 BDS 更新与 CF 包下载共用,避免两处复制 lastTime/lastLoaded 环路(DRY)。

    LSP:与 httpDownload 契约对齐——中途 total=0(无 Content-Length)仍可回调; 总量一旦变为已知(含 finish 用 finalBytes 补总量),经 setTotal 修正刻度,避免卡在占位 1MB。

    Parameters

    Returns

    (downloaded: number, total: number) => void