The File and Directory Entries API simulates a local file system that web apps can navigate within and access files in. You can develop apps which read, write, and create files and/or directories in a virtual, sandboxed file system.
The File and Directory Entries API simulates a local file system that web apps can navigate within and access files in. You can develop apps which read, write, and create files and/or directories in a virtual, sandboxed file system.
There are two ways to get access to file systems defined in the current specification draft:
drop event for drag and drop, you can call DataTransferItem.webkitGetAsEntry() to get the FileSystemEntry for a dropped item. If the result isn't null, then it's a dropped file or directory, and you can use file system calls to work with it.HTMLInputElement.webkitEntries property lets you access the FileSystemFileEntry objects for the currently selected files, but only if they are dragged-and-dropped onto the file chooser (Firefox bug 1326031). If HTMLInputElement.webkitdirectory is true, the <input> element is instead a directory picker, and you get FileSystemDirectoryEntry objects for each selected directory.The File and Directory Entries API includes the following interfaces:
FileSystemRepresents a file system.
FileSystemEntryThe basic interface representing a single entry in a file system. This is implemented by other interfaces which represent files or directories.
FileSystemFileEntryRepresents a single file in a file system.
FileSystemDirectoryEntryRepresents a single directory in a file system.
FileSystemDirectoryReaderCreated by calling FileSystemDirectoryEntry.createReader(), this interface provides the functionality which lets you read the contents of a directory.
| Specification |
|---|
| File and Directory Entries API # api-domfilesystem |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
File_and_Directory_Entries_API |
7 | ≤18Edge only supports this API in drag-and-drop scenarios using theDataTransferItem.webkitGetAsEntry() method. It's not available for use in file or folder picker panels (such as when you use an <input> element with the HTMLInputElement.webkitdirectory attribute. |
50 | No | 15 | 11.1 | ≤37 | 18 | 50 | 14 | 11.3 | 1.0 |
name |
7 | ≤18 | 50 | No | 15 | 11.1 | ≤37 | 18 | 50 | 14 | 11.3 | 1.0 |
root |
7 | ≤18 | 50 | No | 15 | 11.1 | ≤37 | 18 | 50 | 14 | 11.3 | 1.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API