expo-file-system: expose the HTTP status from DownloadTask.downloadAsync() / File.downloadFileAsync()
Scott Robinson
UploadTask.uploadAsync() resolves with { status, headers, body } for any completed HTTP response, including a non-2xx one. Downloads have nothing equivalent: a non-2xx rejects with an UnableToDownload error, and the status only appears in the message text, worded differently on each platform (iOS "server returned HTTP 404", Android "HTTP 404"; expo-file-system 58.0.15).
Apps that act on the status have to parse that text, or stay on expo-file-system/legacy's createDownloadResumable, whose downloadAsync() resolves with status. We stay on legacy for exactly this: we download gated files, where a 401 or 404 means "no access" and the app explains that rather than showing a generic failure.
Either would do:
- a status (and ideally headers) property on the UnableToDownload error, or
- an option to resolve with { file, status, headers } for a completed response instead of rejecting on non-2xx, matching uploadAsync().
This would let the remaining legacy download users move to the new API before the legacy entry is removed.