Is it so important to use java.io.File in your project? Why you don't just work with IndexedDB directly? java.io.File was not designed to be implemented over IndexedDB and thus you won't get efficient result. TeaVM provides java.io.File implementation for compatibility, i.e. there's already some library that uses java.io.File. I implemented this API to compile javac, which relies on
java.io heavily.
Anyway, if for some reason you want to use java.io.File, you can just implement VirtualFileSystem interface over IndexedDB and pass it to VirtualFileSystemProvider.setInstance in the very beginning of your entry point. There are two distinct strategies of writing such implementation:
1. Implement with @Async annotation, all reads/writes will be performed as they are requested by the code. Note that this will provide less efficient bloated code, not only at the points where you use java.io.File API, but on other, unpredictable points of application.
2. Implement without @Async annotation. Read entire FS content from IndexedDB on the very beginning of entry point, use deferred writes to IndexedDB during execution.