QVAC Logo

downloadAsset( )

Downloads an asset (model file) without loading it into memory.

function downloadAsset(options): Promise<string>;

Parameters

NameTypeRequired?Description
optionsDownloadAssetOptionsDownload configuration

DownloadAssetOptions

FieldTypeRequired?Description
assetSrcstringThe location from which the asset is downloaded (local path, remote URL, or Hyperdrive pear:// URL)
seedbooleanWhether to seed the asset on Hyperdrive after download
onProgress(progress: ModelProgressUpdate) => voidCallback for real-time download progress updates. When provided, streaming is used.

Returns

Promise<string> — Resolves to the asset ID (either the provided assetSrc or a generated ID).

Throws

ErrorWhen
DOWNLOAD_ASSET_FAILEDThe download operation fails
STREAM_ENDED_WITHOUT_RESPONSEStreaming ends without a final response (when using onProgress)
INVALID_RESPONSE_TYPEResponse type does not match expected "downloadAsset"

Example

// Download model without loading
const assetId = await downloadAsset({
  assetSrc: "/path/to/model.gguf",
  seed: true
});

// Download with progress tracking
const assetId = await downloadAsset({
  assetSrc: "pear://key123/model.gguf",
  onProgress: (progress) => {
    console.log(`Downloaded: ${progress.percentage}%`);
  }
});

On this page