JSFileSystemSyncAccessHandle extension
Represents a synchronous handle to a file system entry. The synchronous nature of the file reads and writes allows for higher performance for critical methods in contexts where asynchronous operations come with high overhead, e.g. WebAssembly.
This class is only accessible inside dedicated Web Workers for files within the origin private file system.
The interface is accessed through the FileSystemFileHandle.createSyncAccessHandle
method.
Example and more on MDN Web Docs
Methods
-
close(
) → void -
Available on FileSystemSyncAccessHandle, provided by the JSFileSystemSyncAccessHandle extension
Closes an open synchronous file handle, disabling any further operations on it and releasing the exclusive lock previously put on the file associated with the file handle. -
flush(
) → void -
Available on FileSystemSyncAccessHandle, provided by the JSFileSystemSyncAccessHandle extension
Persists any changes made to the file associated with the handle via the write method to disk. -
getSize(
) → int -
Available on FileSystemSyncAccessHandle, provided by the JSFileSystemSyncAccessHandle extension
Returns the size of the file associated with the handle in bytes. -
read(
Uint8List buffer, {int? offset}) → int -
Available on FileSystemSyncAccessHandle, provided by the JSFileSystemSyncAccessHandle extension
Reads the content of the file associated with the handle into a specifiedbuffer
, optionally starting to read at a givenoffset
. The file cursor is updated when read is called to point to the byte after the last byte read. -
truncate(
int newSize) → void -
Available on FileSystemSyncAccessHandle, provided by the JSFileSystemSyncAccessHandle extension
Resizes the file associated with the handle to a specified number of bytes. -
write(
Uint8List buffer, {int? offset}) → int -
Available on FileSystemSyncAccessHandle, provided by the JSFileSystemSyncAccessHandle extension
Writes the content of a specifiedbuffer
to the file associated with the handle, optionally writing at a givenoffset
from the start of the file. The file cursor is updated when write is called to point to the byte after the last byte written.