birdofpreyru / react-native-fs

File system access for React Native
https://dr.pogodin.studio/docs/react-native-file-system
Other
121 stars 8 forks source link

Response Headers while downloading files #18

Closed Karrthik-Arya closed 8 months ago

Karrthik-Arya commented 8 months ago

This pull request adds response headers to the DownloadResult object being returned after downloading a file. This might be useful for people who might need things like entity tags

birdofpreyru commented 8 months ago

Thanks @Karrthik-Arya , but after a look at it I am hesitant to merge it in for a few reasons:

  1. It looks to me that these headers already can be fetched via download begin hook. I don't see a reason to duplicate this in two places. It looks like beside the headers that begin hook returns the same information as the download promise... thus, perhaps, it makes sense to drop the begin hook altogether (as I guess it is fired at about the same time the download promise resolves), but that's not something I'd invest my time into right now (not without any financial support from anybody for this library).

  2. Your PR adds this for Android only. Thus, in addition to the previous point, in its current state it will also introduce an unnecessary difference between library API on different platforms; while the purpose of React Native is exactly the opposite — to unify APIs across platforms whenever possible.

birdofpreyru commented 8 months ago

I guess, for now I'll close your PR, but I've opened an issue ticket to keep a memory of it for future.