Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1125139 of FileSystem

  • Revision slug: Web/API/FileSystem
  • Revision title: FileSystem
  • Revision id: 1125139
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment Edge compat; update text to clarify and remove some browser-specific issues

Revision Content

{{APIRef("File System API")}} {{non-standard_header}}

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

Because this is a non-standard API, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. Check the {{anch("Browser compatibility")}} section for details.

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 {{domxref("FileSystemEntry.filesystem", "filesystem")}} property.

Properties

{{domxref("FileSystem.name")}} {{ReadOnlyInline}}
A {{domxref("DOMString")}} representing the file system's name. This name is unique among the entire list of exposed file systems.
{{domxref("FileSystem.root")}} {{ReadOnlyInline}}
A {{domxref("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

Specification Status Comment
{{SpecName('File System API')}} {{Spec2('File System API')}} Draft of proposed API

This API has no official W3C or WHATWG specification.

Browser compatibility

{{ CompatibilityTable }}

Feature Chrome Firefox (Gecko) Internet Explorer Microsoft Edge Opera Safari (WebKit)
Basic support 13{{ property_prefix("webkit") }} {{ CompatGeckoDesktop(50) }} {{ CompatNo }} {{CompatVersionUnknown}}[1] {{ CompatNo }} {{ CompatNo }}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatNo }} 0.16{{ property_prefix("webkit") }} {{ CompatGeckoMobile(50) }} {{ CompatNo }} {{ CompatNo }} {{ CompatNo }}

[1] Microsoft Edge implements this interface under the name WebKitFileSystem, and supports its use only in drag-and-drop scenarios using the {{domxref("File.webkitGetAsEntry()")}} method. It's not available for use in file or folder picker panels (such as when you use an {{HTMLElement("input")}} element with the {{domxref("HTMLInputElement.webkitdirectory")}} attribute.

See also

Revision Source

<p>{{APIRef("File System API")}} {{non-standard_header}}</p>

<p>The File and Directory Entries API interface <strong><code>FileSystem</code></strong> is used to represent a file system. These objects can be obtained from the {{domxref("FileSystemEntry.filesystem", "filesystem")}} property on any file system entry. Some browsers offer additional APIs to create and manage file systems, such as Chrome's {{domxref("LocalFileSystem.requestFileSystem", "requestFileSystem()")}} method.</p>

<div class="note">
<p>Because this is a non-standard API, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. Check the {{anch("Browser compatibility")}} section for details.</p>
</div>

<h2 id="Basic_concepts">Basic concepts</h2>

<p>There are two ways to get access to a <code>FileSystem</code> object:</p>

<ol>
 <li>You can directly ask for one representing a sandboxed file system created just for your web app directly by calling <code>window.requestFileSystem()</code>.&nbsp; If that call is successful, it executes a callback handler, which receives as a parameter a <code>FileSystem</code> object describing the file system.</li>
 <li>You can get it from a file system entry object, through its {{domxref("FileSystemEntry.filesystem", "filesystem")}} property.</li>
</ol>

<h2 id="Properties">Properties</h2>

<dl>
 <dt>{{domxref("FileSystem.name")}} {{ReadOnlyInline}}</dt>
 <dd>A {{domxref("DOMString")}} representing the file system's name. This name is unique among the entire list of exposed file systems.</dd>
 <dt>{{domxref("FileSystem.root")}} {{ReadOnlyInline}}</dt>
 <dd>A {{domxref("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.</dd>
</dl>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('File System API')}}</td>
   <td>{{Spec2('File System API')}}</td>
   <td>Draft of proposed API</td>
  </tr>
 </tbody>
</table>

<p>This API has no official W3C or WHATWG specification.</p>

<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>

<p>{{ CompatibilityTable }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Microsoft Edge</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>13{{ property_prefix("webkit") }}</td>
   <td>{{ CompatGeckoDesktop(50) }}</td>
   <td>{{ CompatNo }}</td>
   <td>{{CompatVersionUnknown}}<sup>[1]</sup></td>
   <td>{{ CompatNo }}</td>
   <td>{{ CompatNo }}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE&nbsp;Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatNo }}</td>
   <td>0.16{{ property_prefix("webkit") }}</td>
   <td>{{ CompatGeckoMobile(50) }}</td>
   <td>{{ CompatNo }}</td>
   <td>{{ CompatNo }}</td>
   <td>{{ CompatNo }}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] Microsoft Edge implements this interface under the name <code>WebKitFileSystem</code>, and supports its use only in drag-and-drop scenarios using the {{domxref("File.webkitGetAsEntry()")}} method. It's not available for use in file or folder picker panels (such as when you use an {{HTMLElement("input")}} element with the {{domxref("HTMLInputElement.webkitdirectory")}} attribute.</p>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Web/API/File_and_Directory_Entries_API">File and Directory Entries API</a></li>
 <li><a href="/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction">Introduction to the File System API</a></li>
 <li>{{domxref("FileSystemEntry")}}, {{domxref("FileSystemFileEntry")}}, and {{domxref("FileSystemDirectoryEntry")}}</li>
 <li>MSDN article: <a href="https://msdn.microsoft.com/library/mt732564">WebKitFileSystem object</a></li>
</ul>
Revert to this revision