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 in a FileSystemOpfsWebDirectoryHandle.

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) and permission requested again.

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

Implementation

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