Do you have to take care of storage in Capacitorjs apps yourself?

13 Views Asked by At

I noticed that every photo that is created via my Capacitor js app is stored inside the (android case) data/app/com.domain.name/files/Pictures. It doesn't matter whether the picture was created using Capacitor.Camera plugin or the <input type="file". Will the operating system wipe this directory itself, like it was a temporary data (which it is)?

Or do I have to take care of this myself?

To be safe, i use this code during the startup screen, but I don't know if it redundant.

try {
    let res = await Filesystem.readdir({
        directory: Directory.External,
        path: 'Pictures'
    });
    for (const file of res.files) {
        await Filesystem.deleteFile({
            directory: Directory.External,
            path: `Pictures/${file.name}`
        });
    }
} catch (_) {}
0

There are 0 best solutions below