QUESTION - Resized image file path
dittmarconsulting opened this issue ยท 4 comments
Hi all,
First of all, I love this package and I have been using it for quite some time without any issues. Well done ๐
I have a question about the file location of the resized images on iOS. I've had a look at the source code and you use NSFileManager
as described here.
Here is my question:
Can the return file path be used as a permanent storage? Meaning, that this file would stay at this position on the file system until it is explicitly deleted by the user or will this file be subject to garbage collection by the OS?
Hello @dittmarconsulting
Thanks for your kind words.
This is actually an interesting topic, nice question.
We are currently using NSCachesDirectory
by default and NSDocumentDirectory
if you use the JS outputPath
attribute . From this stack overflow response, it looks like the Caches directory is sometimes clean up by the OS, which makes sense because you can set a size in native to the cache you want. However from this answer it also means that NSDocumentDirectory
is not wiped randomly by the OS, which I also believe makes sense because that coud lead our apps to really unstable states if we can not use reliably some external resources in a Document folder.
Thanks for the quick reply @PierreCapo.
I want to highlight what I want to do:
I'm planning to save up to 1000 (resized) images, with a total volume of ~150 - 300MB, in the file system of the phone, when the phone is in offline mode. Once the phone is online again, I will sync these images to the cloud and remove them all from the file system automatically.
Since I can't predict how long the phone might be offline, I have to make sure these images DO NOT get deleted from the file system by the OS.
On the other hand, I don't want to have the resized images in one folder and save the same images in another NSDocumentDirectory
folder just to guarantee that the images don't get lost.
That was the background for my question. Because if I could just keep the resized images where they were created by the function createResizedImage
it would save me the effort to manage 2 directories.
What do you think?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed. Thank you for your contributions.