openOpfsBytesFile function
Opens (or creates) a logical file backed by OPFS chunks.
create: create an empty file when it does not exist (ignored whenreadOnlyis true, matchingdart:io'sFileMode.read).readOnly: rejects every mutating call with a StateError.chunkSize: only used when the file is created; existing files keep the chunk size recorded in their manifest. Defaults to 16 MiB.workers: chunk workers in the page-wide pool; the first open wins. Defaults to OpfsWorkerPool.defaultWorkers.
Throws UnsupportedError when the browser has no OPFS / worker sync handle,
WebFileSystemException with NotFoundError when create is false and the
file is missing, and WebQuotaExceededException when the origin is full.
Implementation
Future<BytesFile> openOpfsBytesFile(
String path, {
bool create = true,
bool readOnly = false,
int chunkSize = kDefaultChunkSize,
int? workers,
}) {
return WebOpfsBytesFile.open(
path,
create: create,
readOnly: readOnly,
chunkSize: chunkSize,
workers: workers,
);
}