Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2023.
* Some parts of this feature may have varying levels of support.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The FileSystemFileHandle interface of the File System API represents a handle to a file system entry. The interface is accessed through the window.showOpenFilePicker() method.
Note that read and write operations depend on file-access permissions that do not persist after a page refresh if no other tabs for that origin remain open. The queryPermission method of the FileSystemHandle interface can be used to verify permission state before accessing a file.
FileSystemHandle FileSystemFileHandleInherits properties from its parent, FileSystemHandle.
Inherits methods from its parent, FileSystemHandle.
getFile()Returns a Promise which resolves to a File object representing the state on disk of the entry represented by the handle.
createSyncAccessHandle()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.
createWritable()Returns a Promise which resolves to a newly created FileSystemWritableFileStream object that can be used to write to a file.
The following asynchronous function presents a file picker and once a file is chosen, uses the getFile() method to retrieve the contents.
The following asynchronous function writes the given contents to the file handle, and thus to disk.
The following asynchronous event handler function is contained inside a Web Worker. On receiving a message from the main thread it:
Note: In earlier versions of the spec, close(), flush(), getSize(), and truncate() were wrongly specified as asynchronous methods, and older versions of some browsers implement them in this way. However, all current browsers that support these methods implement them as synchronous methods.
| File System # api-filesystemfilehandle |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 26, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.