Skip to content

feat(storage): add DownloadSessionDelegate and download API with pause/resume/cancel#993

Open
grdsdev wants to merge 2 commits into
stacked/pr2-tusfrom
stacked/pr3-downloads
Open

feat(storage): add DownloadSessionDelegate and download API with pause/resume/cancel#993
grdsdev wants to merge 2 commits into
stacked/pr2-tusfrom
stacked/pr3-downloads

Conversation

@grdsdev
Copy link
Copy Markdown
Contributor

@grdsdev grdsdev commented May 7, 2026

Summary

Stacked on #992.

  • Adds DownloadSessionDelegate routing URLSessionDownloadDelegate callbacks by taskIdentifier, enabling background URLSession support
  • Adds download(path:)StorageDownloadTask — downloads to disk with pause/resume/cancel via URLSessionDownloadTask
  • Adds downloadData(path:)StorageTransferTask<Data> — convenience wrapper that loads into memory
  • Adds backgroundDownloadSessionIdentifier config for background transfers
  • Adds StorageClient.handleBackgroundEvents(forSessionIdentifier:completionHandler:) for AppDelegate wiring

Test plan

  • DownloadSessionDelegateTests — all pass
  • StorageDownloadTaskTests — all pass
  • StorageFileAPITests — all pass (including download tests)

🤖 Generated with Claude Code

grdsdev and others added 2 commits May 8, 2026 06:07
- Add TUSUploadEngine actor implementing TUS 1.0.0 resumable uploads with
  6 MB chunks, pause/resume/cancel, 409 offset re-sync, and cooperative
  Swift Task cancellation
- Add UploadMethod enum (.auto, .multipart, .resumable) as a parameter on
  upload() and update()
- .auto picks multipart for files <= 6 MB and TUS for larger files
  (configurable via tusChunkSize)
- Add tusChunkSize to StorageClientConfiguration

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…e/resume/cancel

- Add DownloadSessionDelegate actor routing URLSessionDownloadDelegate callbacks
  by taskIdentifier, enabling background URLSession support
- Add download(path:) -> StorageDownloadTask — downloads to disk with
  pause/resume/cancel via URLSessionDownloadTask
- Add downloadData(path:) -> StorageTransferTask<Data> — convenience wrapper
  that loads into memory
- Add backgroundDownloadSessionIdentifier config for background transfers
- Add StorageClient.handleBackgroundEvents(forSessionIdentifier:completionHandler:)
  for AppDelegate wiring

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@grdsdev grdsdev force-pushed the stacked/pr3-downloads branch from 414735a to e8bf6e7 Compare May 8, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant