downloadWithProgress static method

Stream<int> downloadWithProgress({
  1. required String url,
  2. required String targetPath,
  3. String? token,
  4. int maxRetries = 10,
})

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;
}