W3cubDocs

/Web APIs

FileSystem

The File and Directory Entries API interface FileSystem is used to represent a file system. These objects can be obtained from the filesystem property on any file system entry. Some browsers offer additional APIs to create and manage file systems, such as Chrome's requestFileSystem() method.

This interface will not grant you access to the users' filesystem. Instead, you will have a "virtual drive" within the browser sandbox if you want to gain access to the users' file system, you need to invoke the user, for example by installing a Chrome extension. The relevant Chrome API can be found here.

Basic concepts

There are two ways to get access to a FileSystem object:

  1. You can directly ask for one representing a sandboxed file system created just for your web app directly by calling window.requestFileSystem(). If that call is successful, it executes a callback handler, which receives as a parameter a FileSystem object describing the file system.
  2. You can get it from a file system entry object, through its filesystem property.

Instance properties

FileSystem.name Read only

A string representing the file system's name. This name is unique among the entire list of exposed file systems.

FileSystem.root Read only

A FileSystemDirectoryEntry object which represents the file system's root directory. Through this object, you can gain access to all files and directories in the file system.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
FileSystem 7
≤18Edge only supports this API in drag-and-drop scenarios using the DataTransferItem.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

See also

© 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/FileSystem