Dub.fetch

Fetches a missing package and stores it locally

This will query the configured PackageSuppliers for a package matching the range specification, store it locally, and load it in the PackageManager. Note that unlike the command line version, this function is not idempotent and will remove an existing package and re-download it.

Parameters

name PackageName

Name of the package to retrieve. Subpackages will lead to the main package being retrieved and the subpackage being returned (if it exists).

range VersionRange

The VersionRange to match. Default to Any to fetch the latest version.

options FetchOptions

A set of options used for fetching / matching versions.

reason string

Optionally, the reason for retriving this package. This is used only for logging.

Return Value

Type: Package

The fetched or loaded Package, or null in dry-run mode.

Throws

If the package cannot be fetched or loaded.

Meta