downloadAsset( ) Downloads an asset (model file) without loading it into memory.
This function is specifically designed for download-only operations and doesn't accept runtime configuration options like modelConfig or delegate. Use this for download-only operations instead of loadModel for better semantic clarity.
function downloadAsset ( options : DownloadAssetOptions , rpcOptions ?: { forceNewConnection ?: boolean ; profiling ?: { enabled ?: boolean ; includeServerBreakdown ?: boolean ; mode ?: "summary" | "verbose" }; timeout ?: number }) : Promise
Name Type Required? Description optionsDownloadAssetOptions✓ Download configuration including:
assetSrc: The location from which the asset is downloaded (local path, remote URL, or Hyperdrive URL)
seed: Optional boolean for hyperdrive seeding
onProgress: Optional callback for download progress |
| rpcOptions | \{ forceNewConnection?: boolean; profiling?: \{ enabled?: boolean; includeServerBreakdown?: boolean; mode?: "summary" | "verbose" \}; timeout?: number \} | ✗ | Optional RPC options including per-call profiling configuration |
Error When When asset download fails, with details in the error messageWhen streaming ends unexpectedly (only when using onProgress)When receiving an invalid response type from the server
// 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 }%` );
}
});