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 408527 of FileEntrySync

  • Revision slug: Web/API/FileEntrySync
  • Revision title: FileEntrySync
  • Revision id: 408527
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 7 words removedDOM/File_API/File_System_API/FileEntrySync Web/API/FileEntrySync

Revision Content

The FileEntrySync interface of the File System API represents a file in a file system. It lets you write content to a file.

Inherits from: EntrySync

About this document

This document was last updated on March 2, 2012 and follows the W3C Specifications (Working Draft) drafted on April 19, 2011.

Basic concepts

To write content to file, create a FileWriter object by calling createWriter().

Method overview

FileWriterSync createWriter () raises (FileException);
File file () raises (FileException);

Methods

createWriter()

Creates a new FileWriter associated with the file that the FileEntry represents.

void createWriter (
) raises (FileException);
Parameter

None.

Returns
FileWriterSync
Exceptions

This method can raise a FileException with the following codes:

Exception Description
NOT_FOUND_ERR The file does not exist.
INVALID_STATE_ERR The file is no longer valid for some reason other than it having been deleted.

file()

Returns a File that represents the current state of the file that this FileEntry represents.

void file (
) raises (FileException);
Parameter

None.

Returns
File
Exceptions

This method can raise a FileException with the following codes:

Exception Description
NOT_FOUND_ERR The file does not exist.
INVALID_STATE_ERR The file is no longer valid for some reason other than it having been deleted.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 13{{ property_prefix("webkit") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatNo() }} 0.16 {{ property_prefix("webkit") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}

See also

Specification:{{ spec("https://dev.w3.org/2009/dap/file-system/pub/FileSystem/", "File API: Directories and System Specification", "WD") }}

Reference: File System API

Introduction: Basic Concepts About the File System API

Revision Source

<p>The <code>FileEntrySync</code> interface of the <a href="/en/DOM/File_API/File_System_API" title="en/DOM/File_API/File_System_API">File System API</a> represents a file in a file system. It lets you write content to a file.</p>
<p>Inherits from: <a href="/en/DOM/File_API/File_System_API/EntrySync" title="EntrySync">EntrySync</a></p>
<h2 id="About_this_document">About this document</h2>
<p>This document was last updated on March 2, 2012 and follows the <a class="external" href="https://www.w3.org/TR/file-system-api/">W3C Specifications (Working Draft)</a> drafted on April 19, 2011.</p>
<h2 id="basic_concepts" name="basic_concepts">Basic concepts</h2>
<p>To write content to file, create a FileWriter object by calling <a href="#createWriter"><code>createWriter()</code></a>.</p>
<h2 id="Method_overview">Method overview</h2>
<table class="standard-table"> <tbody> <tr> <td><code>FileWriterSync <a href="#createReader" title="#createWriter">createWriter</a> () raises (<a href="/en/DOM/File_API/File_System_API/FileException" title="en/DOM/File_API/File_System_API/FileException">FileException</a>);</code></td> </tr> <tr> <td><code>File <a href="#File" title="#file">file</a> () raises (<a href="/en/DOM/File_API/File_System_API/FileException" title="en/DOM/File_API/File_System_API/FileException">FileException</a>);</code></td> </tr> </tbody>
</table>
<h2 id="Methods">Methods</h2>
<h3 id="createWriter" name="createWriter">createWriter()</h3>
<p>Creates a new <code>FileWriter</code> associated with the file that the <code>FileEntry</code> represents.</p>
<pre>void createWriter (
) raises (<a href="https://developer.mozilla.org/en/DOM/File_API/File_System_API/FileException">FileException</a>);</pre>
<h5 id="Parameter">Parameter</h5>
<p>None.</p>
<h5 id="Returns">Returns</h5>
<dl> <dt><code>FileWriterSync</code></dt>
</dl>
<h5 id="Exceptions">Exceptions</h5>
<p>This method can raise a <a href="/en/DOM/File_API/File_System_API/FileException" title="en/DOM/File_API/File_System_API/FileException">FileException</a> with the following codes:</p>
<table class="standard-table"> <thead> <tr> <th scope="col" width="131">Exception</th> <th scope="col" width="698">Description</th> </tr> <tr> <td><code>NOT_FOUND_ERR</code></td> <td>The file does not exist.</td> </tr> <tr> <td><code>INVALID_STATE_ERR</code></td> <td>The file is no longer valid for some reason other than it having been deleted.</td> </tr> </thead> <tbody> </tbody>
</table>
<h3 id="File" name="File">file()</h3>
<p>Returns a File that represents the current state of the file that this <code>FileEntry</code> represents.</p>
<pre>void file (
) raises (<a href="https://developer.mozilla.org/en/DOM/File_API/File_System_API/FileException">FileException</a>);</pre>
<h5 id="Parameter">Parameter</h5>
<p>None.</p>
<h5 id="Returns">Returns</h5>
<dl> <dt><code>File</code></dt>
</dl>

<h5 id="Exceptions">Exceptions</h5>
<p>This method can raise a <a href="/en/DOM/File_API/File_System_API/FileException" title="en/DOM/File_API/File_System_API/FileException">FileException</a> with the following codes:</p>
<table class="standard-table"> <thead> <tr> <th scope="col" width="131">Exception</th> <th scope="col" width="698">Description</th> </tr> <tr> <td><code>NOT_FOUND_ERR</code></td> <td>The file does not exist.</td> </tr> <tr> <td><code>INVALID_STATE_ERR</code></td> <td>The file is no longer valid for some reason other than it having been deleted.</td> </tr> </thead> <tbody> </tbody>
</table>
<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>Opera</th> <th>Safari (WebKit)</th> </tr> <tr> <td>Basic support</td> <td>13{{ property_prefix("webkit") }}</td> <td>{{ CompatNo() }}</td> <td>{{ CompatNo() }}</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 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>{{ CompatNo() }}</td> <td>{{ CompatNo() }}</td> <td>{{ CompatNo() }}</td> <td>{{ CompatNo() }}</td> </tr> </tbody> </table>
</div>
<h2 id="See_also">See also</h2>
<p>Specification:{{ spec("https://dev.w3.org/2009/dap/file-system/pub/FileSystem/", "File API: Directories and System Specification", "WD") }}</p>
<p>Reference: <a href="/en/DOM/File_API/File_System_API" title="en/DOM/File_API/File_System_API">File System API</a></p>
<p>Introduction: <a href="/en/DOM/File_APIs/Filesystem/Basic_Concepts_About_the_Filesystem_API" title="en/DOM/File_APIs/Filesystem/Basic_Concepts_About_the_Filesystem_API">Basic Concepts About the File System API</a></p>
Revert to this revision