Skip to main content

plan_from_fd

Function plan_from_fd 

Source
pub async fn plan_from_fd(
    fd_path: impl AsRef<Path>,
    url: Option<Url>,
    partial_config: PartialConfig,
    tx: Tx,
    token: CancellationToken,
) -> Result<DownloadPlan, PlanError>
Expand description

Prepare a download driven by a .fd state file used as a download manifest.

Unlike super::plan_resume, which is given the .part and looks for its companion .fd, this entry takes the .fd itself. The sibling .part decides whether the run resumes recorded progress or reuses the manifest configuration for a fresh download.

url is optional: when omitted, the durable initial URL recorded in the .fd is used. Resume requires a range-capable server; without one the manifest is still reused for a fresh, single-stream download.

ยงErrors

Returns PlanError::Resume when fd_path is not a .fd file, the .fd cannot be read or decoded, no URL can be resolved, or the prefetch fails.