This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The FileSystemFileEntry interface of the File System API represents a file in a file system. It offers properties describing the file's attributes, as well as the file() method, which creates a File object that can be used to read the file.

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 Browser compatibility section for details.


Inherits the properties of its parent interface, FileSystemEntry, but has no properties unique to this interface.


Creates a new File object which can be used to read the file.

Obsolete methods

Creates a new FileWriter object which allows writing to the file represented by the file system entry.

Basic concepts

To write content to file, create a FileWriter object by calling createWriter(). To read a file, obtain a File object representing its contents by calling file().


The following code creates an empty file called "log.txt" (if it doesn't exist) and fills it with the text "Meow". Inside the success callback, event handlers are set up to handle the error error and writeend events. The text data is written to the file by creating a blob, appending text to it, and passing the blob to FileWriter.write().

function onInitFs(fs) {
  fs.root.getFile('log.txt', {create: true}, function(fileEntry) {

    // Create a FileWriter object for our FileSystemFileEntry (log.txt).
    fileEntry.createWriter(function(fileWriter) {
      fileWriter.onwriteend = function(e) {
        console.log('Write completed.');

      fileWriter.onerror = function(e) {
        console.log('Write failed: ' + e.toString());

      // Create a new Blob and write it to log.txt.
      var bb = new BlobBuilder();
    }, errorHandler);

  }, errorHandler);


window.requestFileSystem(window.TEMPORARY, 1024*1024, onInitFs, errorHandler);


Specification Status Comment
File and Directory Entries API Draft Draft of proposed API

This API has no official W3C or WHATWG specification.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support13 webkit No150 No No No
createWriter13 No50 — 522 No No No
file13 No50 No No No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes webkit Yes webkit No150 No No ?
createWriter Yes Yes No50 — 522 No No ?
file Yes Yes No50 No No ?

1. Edge implements this interface as part of the WebKitEntry interface, which is its name for FileSystemEntry.

2. While the createWriter() method existed, it immediately called errorCallback with the NS_ERROR_DOM_SECURITY_ERR error.

See also

Document Tags and Contributors

Last updated by: fscholz,