After the user uploads a file to the bucket I want to reduce its size using a function with the help of the sharp node js library.
I was wondering if when I am saving the file sharp().toFile() method and then re-upload it to the bucket is the file going to live in the open runtime container? If the worker clears the container is the file going to live on the disk?
Summary
The user wants to implement image compression for Appwrite. It is recommended to check out the Storage and Process Photo sections in the provided link. When using the sharp library, the file will live in the open runtime container. If the worker clears the container, the file will be removed. To update the file, create a new file in Appwrite Storage and remove the old one by its ID. Use the new ID wherever needed.
joeyouss
Apr 5, 2023, 16:59
Hi
joeyouss
Apr 5, 2023, 17:00
It is gonna be in separate runtimes
joeyouss
Apr 5, 2023, 17:00
And regarding re-uploading, it's important to mention you cannot updateFile. You would need to create new file in Appwrite Storage, and remove old one by it's ID. Then use new ID where-ever you need
Monzim
Rank 2: Process
Apr 5, 2023, 17:15
so after the function is completed the disk file will be removed by the runtime?
joeyouss
Apr 5, 2023, 17:26
worst-case scenario, it will be removed after 15 minutes of inactivity (when runtime stops).
Its still recommended to delete the file anyway, yes. To preserve disk space.
Monzim
Rank 2: Process
Apr 5, 2023, 17:55
Thanks. Is there any better way to implement image compression for appwrite?