mozilla

Revision 481455 of FileHandle

  • Revision slug: Web/API/FileHandle
  • Revision title: FileHandle
  • Revision id: 481455
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment

Revision Content

{{non-standard_header}}

Summary

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

As FileHandle object are bound to a fake file system build on top of IndexedDB, such 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")}} {{readonlyinline}}
The {{event("abort")}} event is triggered each time the handled file is abort.
{{domxref("FileHandle.onerror")}} {{readonlyinline}}
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 associate 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>{{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 lock.</p>
<p>As <code>FileHandle</code> object are bound to a fake file system build on top of IndexedDB, such object is created using the {{domxref("IDBDatabase.mozCreateFileHandle")}} method.</p>
<h2 id="Properties" name="Properties">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")}} {{readonlyinline}}</dt>
  <dd>
    The {{event("abort")}} event is triggered each time the handled file is abort.</dd>
  <dt>
    {{domxref("FileHandle.onerror")}} {{readonlyinline}}</dt>
  <dd>
    The {{event("error")}} event is triggered each time something goes wrong.</dd>
</dl>
<h2 id="Method_overview" name="Method_overview">Methods</h2>
<dl>
  <dt>
    {{domxref("FileHandle.open()")}}</dt>
  <dd>
    Returns a {{domxref("LockedFile")}} object to read or write the associate 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 id="Browser_Compatibility" name="Browser_Compatibility">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