filesystem: Allow specifying custom IndexedDB name on Web and/or default to provided Directory
name in IndexedDB name
#2228
Labels
Directory
name in IndexedDB name
#2228
Feature Request
Plugin
Filesystem
Description
Currently, the filesystem plugin operates on the "Disc" IndexedDB directory. However there is no way to change or customize this. It would be nice to specify the database to operate on when making calls into the plugin. Alternatively you could use the
FilesystemDirectory
argument as the database name/suffix.Disc_EXTERNAL
, etc.This is related to #2227
Platform(s)
Web
Preferred Solution
Allow passing
webDBName
(orrootDirName
or whatever you want to call it) as a parameter to API methods on the Filesystem plugin. Relevant operations could even automatically create the folder onios
andAndroid
.Ideally in addition to this, or -- at a minimum, the IndexedDB database name should default to the
directory
provided:Alternatives
I suppose you could use open an IndexedDB handle on web, then issue a delete operation using the key value, instead of using recursion:
https://github.com/ionic-team/capacitor-plugins/blob/main/filesystem/src/web.ts#L357
Additional Context
Essentially, it's impossible to clear "just one path" in a very large virtual filesystem directory on Web in a performant manner. Since the
rmdir
operation is recursive and has to iterate all entries, this is a VERY slow operation and is fairly painful for the user to wait for on Web platform.The text was updated successfully, but these errors were encountered: