Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access 'createSyncAccessHandle' on type FileSystemFileHandle

Property 'createSyncAccessHandle' does not exist on type 'FileSystemFileHandle'.ts(2339)

const root = await navigator.storage.getDirectory();

const File1 = await root.getFileHandle('file.txt', { create: true });

const accessHandle = await File1.createSyncAccessHandle();

Based on the docs we have createSyncAccessHandle method but is not found, whether I am missing something

Image

like image 411
rambo Avatar asked Jun 08 '26 05:06

rambo


1 Answers

The docs state:

The createSyncAccessHandle() method of the FileSystemFileHandle interface returns a Promise which resolves to a FileSystemSyncAccessHandle object that can be used to synchronously read from and write to a file. The synchronous nature of this method brings performance advantages, but it is only usable inside dedicated Web Workers for files within the origin private file system.

So my question is, are you runnning this inside a Web Worker?

like image 188
Elvis Adomnica Avatar answered Jun 10 '26 18:06

Elvis Adomnica