downloadWithProgress static method
Downloads a file from HuggingFace with smart ETag handling
url
- HuggingFace file URL
targetPath
- Local file path to save to
token
- HuggingFace authorization token
maxRetries
- Maximum number of download attempts (default: 10)
onProgress
- Progress callback (0-100)
Implementation
static Stream<int> downloadWithProgress({
required String url,
required String targetPath,
String? token,
int maxRetries = 10,
}) {
final progress = StreamController<int>();
_downloadWithSmartRetry(
url: url,
targetPath: targetPath,
token: token,
maxRetries: maxRetries,
progress: progress,
currentAttempt: 1,
);
return progress.stream;
}