inDirectory static method

Future<SimpleOpfsFileSystem> inDirectory(
  1. FileSystemDirectoryHandle root, {
  2. String vfsName = 'simple-opfs',
  3. bool readWriteUnsafe = false,
})

Loads an SimpleOpfsFileSystem in the desired root directory, which must be a Dart wrapper around a FileSystemDirectoryHandle.

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> inDirectory(
  FileSystemDirectoryHandle root, {
  String vfsName = 'simple-opfs',
  bool readWriteUnsafe = false,
}) async {
  final fs = SimpleOpfsFileSystem(vfsName: vfsName);
  await fs.open(root, readWriteUnsafe: readWriteUnsafe);
  return fs;
}