Add a way to configure destination directory#68
Conversation
|
@froger Can you put these methods part of the |
|
@wcandillon yes sure, when I started I though "it could have more options". But when finished writing, my thoughts were "all this code just to rewrite BASE_URL". I will find something more straight forward and write some unit-tests as well. But I don't know if this feature is somewhat useful in the scope of the lib. The no-brainer&no-config of the lib is quiet pleasant, so at this end maybe this feature have no places in your lib. |
|
@wcandillon I've updated my pull request, and did some tests on a project of mine. What I've done
What's next Basically, introducing a
These updates worked good for my project, but again, maybe this lib doesn't need them. |
wcandillon
left a comment
There was a problem hiding this comment.
Looks good. Made two minor comments. I will integrate your branch in my own projects in order to do a bit more testing.
| import SHA1 from "crypto-js/sha1"; | ||
|
|
||
| const BASE_DIR = `${FileSystem.cacheDirectory}expo-image-cache/`; | ||
| let _baseDir = `${FileSystem.cacheDirectory}expo-image-cache/`; |
There was a problem hiding this comment.
For simplicity, would it be possible to add this method to CacheManager for simplicity?
| * As we can now set an uri that is not in the cacheDirectory, | ||
| * we need to be able to delete files. | ||
| */ | ||
| export const removeCacheEntry = async (uri: string): Promise => { |
There was a problem hiding this comment.
should return be await and Promise be Promise<void>?
…o-image-cache into cache-config
|
@froger Could you rebase against the latest version? |
I have a use case where I need to cache permanently the images.
The application we are on will be used most of the time offline, and should not ever destroy image caches.
I just added in this pull request the ability to edit the
BASE_URLconfiguration outside the lib.