FileSystemOpfsWeb.withRootHandle constructor

FileSystemOpfsWeb.withRootHandle(
  1. FileSystemOpfsWebDirectoryHandle rootDirectoryHandle
)

File system rooted at an existing JS FileSystemDirectoryHandle.

rootDirectoryHandle is typically obtained from showDirectoryPicker (Chromium-only) or by wrapping a handle persisted in IndexedDB (FileSystemOpfsWebDirectoryHandle.fromJsObject).

final handle = await FileSystemOpfsWeb.showDirectoryPicker();
final fs = FileSystemOpfsWeb.withRootHandle(handle);

Write operations require the handle to have been granted readwrite permission. Handles do not persist across page reloads unless saved by the application (e.g. in IndexedDB, see FileSystemOpfsWebFileSystemEntityHandleExtension.jsObject) and permission requested again (see queryPermission and requestPermission).

Only available on the web. Links and random access are not supported.

Implementation

factory FileSystemOpfsWeb.withRootHandle(
  FileSystemOpfsWebDirectoryHandle rootDirectoryHandle,
) => fileSystemOpfsWebWithRootHandleImpl(rootDirectoryHandle);