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 965665 of IDBMutableFile

  • Revision slug: Web/API/IDBMutableFile
  • Revision title: FileHandle
  • Revision id: 965665
  • Created:
  • Creator: chrisdavidmills
  • Is current revision? No
  • Comment Web/API/FileHandle Web/API/IDBMutableFile

Revision Content

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

Summary

The FileHandle interface provides access in read or write mode to a file, dealing with all the necessary locks.

As FileHandle objects are bound to a fake file system built on top of IndexedDB, such an object is created using the {{domxref("IDBDatabase.mozCreateFileHandle")}} method.

Properties

{{domxref("FileHandle.name")}} {{readonlyinline}}
The name of the handled file.
{{domxref("FileHandle.type")}} {{readonlyinline}}
The mime type of the handled file.

Events Handler

{{domxref("FileHandle.onabort")}}
The {{event("abort")}} event is triggered each time the handled file is aborted.
{{domxref("FileHandle.onerror")}}
The {{event("error")}} event is triggered each time something goes wrong.

Methods

{{domxref("FileHandle.open()")}}
Returns a {{domxref("LockedFile")}} object to read or write the associated file safely.
{{domxref("FileHandle.getFile()")}}
Returns a {{domxref("DOMRequest")}} object. In case of success, the request's result is a {{domxref("File")}} object representing a snapshot of the handled file.

Specifications

Specification Status Comment
{{SpecName('FileSystem')}} {{Spec2('FileSystem')}} Draft proposal.

See also

  • {{domxref("LockedFile")}}
  • {{domxref("File")}}

Revision Source

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

<h2 id="Summary">Summary</h2>

<p>The <code>FileHandle</code> interface provides access in read or write mode to a file, dealing with all the necessary locks.</p>

<p>As <code>FileHandle</code> objects are bound to a fake file system built on top of IndexedDB, such an object is created using the {{domxref("IDBDatabase.mozCreateFileHandle")}} method.</p>

<h2>Properties</h2>

<dl>
 <dt>{{domxref("FileHandle.name")}} {{readonlyinline}}</dt>
 <dd>The name of the handled file.</dd>
 <dt>{{domxref("FileHandle.type")}} {{readonlyinline}}</dt>
 <dd>The mime type of the handled file.</dd>
</dl>

<h3 id="Events_Handler">Events Handler</h3>

<dl>
 <dt>{{domxref("FileHandle.onabort")}}</dt>
 <dd>The {{event("abort")}} event is triggered each time the handled file is aborted.</dd>
 <dt>{{domxref("FileHandle.onerror")}}</dt>
 <dd>The {{event("error")}} event is triggered each time something goes wrong.</dd>
</dl>

<h2>Methods</h2>

<dl>
 <dt>{{domxref("FileHandle.open()")}}</dt>
 <dd>Returns a {{domxref("LockedFile")}} object to read or write the associated file safely.</dd>
 <dt>{{domxref("FileHandle.getFile()")}}</dt>
 <dd>Returns a {{domxref("DOMRequest")}} object. In case of success, the request's result is a {{domxref("File")}} object representing a snapshot of the handled file.</dd>
</dl>

<h2>Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('FileSystem')}}</td>
   <td>{{Spec2('FileSystem')}}</td>
   <td>Draft proposal.</td>
  </tr>
 </tbody>
</table>

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

<ul>
 <li>{{domxref("LockedFile")}}</li>
 <li>{{domxref("File")}}</li>
</ul>
Revert to this revision