loadFromStorage static method
Loads an SimpleOpfsFileSystem in the desired path under the root directory
for OPFS as given by navigator.storage.getDirectory() in JavaScript.
Throws a VfsException if OPFS is not available - please note that this file system implementation requires a recent browser and only works in dedicated web workers.
When readWriteUnsafe is passed, the synchronous file handles are opened
using the proposed lock mode.
This mode is currently not supported across browsers, but can be used on
Chrome for faster database access across tabs.
Implementation
static Future<SimpleOpfsFileSystem> loadFromStorage(
String path, {
String vfsName = 'simple-opfs',
bool readWriteUnsafe = false,
}) async {
final storage = storageManager;
if (storage == null) {
throw VfsException(SqlError.SQLITE_ERROR);
}
final (_, directory) = await _resolveDir(path);
return inDirectory(directory,
vfsName: vfsName, readWriteUnsafe: readWriteUnsafe);
}