kfiroo / react-native-cached-image

CachedImage component for react-native
MIT License
940 stars 468 forks source link

Support all file extensions #110

Closed jln-dk closed 2 years ago

jln-dk commented 6 years ago

Changed generateCacheKey so it now supports all file extensions

Before it only supported image specific file types. I see no need for that, because the ImageCacheManager now can be used to cache any type of file, e.g. video files or pdf files.

jln-dk commented 6 years ago

@kfiroo Could you please have a look at this PR?

rnowm commented 6 years ago

Please merge that one. In my project I also need to cache videos and audio. In fact you should be renaming the whole project to react-native-cached-files :) Thanks!

DavitVosk commented 6 years ago

@chrusart @kfiroo Please merge this PR. We all need this option in the package. Thanks

DavitVosk commented 6 years ago

@jesperlndk can you please explain how this will work for example with react-native-video? How react-native-video sees that the videos are cached? How they interact with each other?

jln-dk commented 6 years ago

@DavitVosk The CacheManger of react-native-cached-image is able to take any web URL and cache it (download the file and store it locally for future use). With this change it will do it's job no matter what type of file it is. So it could be a video file in your situation, and then you just pass the cached file URL to react-native-video.

DavitVosk commented 6 years ago

@jesperlndk Thanks for your answer. I receive Download failed when trying to cache videos with qt extension (recorded video), but with mp4 it worked as needed. Going deeply into the codes I saw that it throws that error due to the following message: “1ee5087081f9427bf3e80a3c4b622c9393a7051b.qt.tmp” couldn’t be moved to “...MY_s3_amazonaws_com_569052e95feac8563a7388c06364f9937a7e6204” because an item with the same name already exists.. Maybe the problem is video extension?