Serialize FileSystemHandle (and directory handle) #2271
-
Hello, I’m trying to see if it’s possible to serialize a FileSystemHandle or FileSystemDirectoryHandle object to local storage. I’m building an app that lets a user pick a local directory and file through a file picker which returns a FileSystemHandle. This has to be from a user initiated action (like a button click) and also have permission to access the file system granted. According to this, the handles are serializable (although the user-granted permission is not and has to be regranted between sessions) and they show a method of serializing the handle objects to IndexedDB. I know by default Pinia is using Local Storage for persistence, and inspecting this, the handles never get properly persisted (there are only empty objects), but the handles are in the in-memory store and can pass between components just fine. My question is whether it’s something to do with local storage vs IndexedDB or if Pinia is not serializing them properly for some reason. If someone can point me in the right direction I could even attempt a PR to fix (if applicable). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Pinia doesn’t persist anything by default so you are free to use or created your own custom storage that uses indexdb |
Beta Was this translation helpful? Give feedback.
Pinia doesn’t persist anything by default so you are free to use or created your own custom storage that uses indexdb