WebDownloadService class
Web implementation of DownloadService
Supports multiple storage modes:
- cacheApi: Cache API with Blob URLs (for models <2GB)
- streaming: OPFS with streaming (for models >2GB)
- none: No caching (ephemeral)
Features:
- URL registration (cacheApi/none modes)
- OPFS streaming download (streaming mode)
- Progress tracking for all modes
- Authentication token support
Design rationale:
- Cache API mode: Fast for small models, browser handles caching
- Streaming mode: Bypasses ArrayBuffer limits for large models
- OPFS provides persistent storage with streaming support
Platform: Web only
- Implemented types
Constructors
- WebDownloadService(WebFileSystemService _fileSystem, WebJsInterop _jsInterop, BlobUrlManager _blobUrlManager, WebCacheService cacheService, {WebOPFSService? opfsService, WebStorageMode webStorageMode = WebStorageMode.cacheApi})
Properties
- cacheService → WebCacheService
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- opfsService → WebOPFSService?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- webStorageMode → WebStorageMode
-
final
Methods
-
download(
String url, String targetPath, {String? token, CancelToken? cancelToken}) → Future< void> -
Downloads a file from URL to target path
override
-
downloadWithProgress(
String url, String targetPath, {String? token, int maxRetries = 10, CancelToken? cancelToken}) → Stream< int> -
Downloads a file with progress tracking
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited