Interface FileEntry

This interface represents a file on a file system.

Hierarchy

Index

Properties

Methods

Properties

public filesystem: FileSystem

The file system on which the entry resides.

public fullPath: string

The full absolute path from the root to the entry.

public isDirectory: boolean

Entry is a directory.

public isFile: boolean

Entry is a file.

public name: string

The name of the entry, excluding the path leading to it.

Methods

public copyTo(parent: DirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): string

Copy an entry to a different location on the file system. It is an error to try to:

  • copy a directory inside itself or to any child at any depth;
  • copy an entry into its parent if a name different from its current one isn't provided;
  • copy a file to a path occupied by a directory;
  • copy a directory to a path occupied by a file;
  • copy any element to a path occupied by a directory which is not empty.
  • A copy of a file on top of an existing file must attempt to delete and replace that file.
  • A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.

Directory copies are always recursive--that is, they copy all contents of the directory.

Parameters

Returns

string

public createWriter(successCallback: FileWriterCallback, errorCallback?: ErrorCallback)

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

Parameters

  • successCallback: FileWriterCallback

    A callback that is called with the new FileWriter.

  • errorCallback?: ErrorCallback optional

    A callback that is called when errors happen.

public file(successCallback: FileCallback, errorCallback?: ErrorCallback)

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

Parameters

  • successCallback: FileCallback

    A callback that is called with the File.

  • errorCallback?: ErrorCallback optional

    A callback that is called when errors happen.

public getMetadata(successCallback: MetadataCallback, errorCallback?: ErrorCallback)

Look up metadata about this entry.

Parameters

  • successCallback: MetadataCallback

    A callback that is called with the time of the last modification.

  • errorCallback?: ErrorCallback optional

    ErrorCallback A callback that is called when errors happen.

public getParent(successCallback: EntryCallback, errorCallback?: ErrorCallback)

Look up the parent DirectoryEntry containing this Entry. If this Entry is the root of its filesystem, its parent is itself.

Parameters

  • successCallback: EntryCallback

    A callback that is called to return the parent Entry.

  • errorCallback?: ErrorCallback optional

    A callback that is called when errors happen.

public moveTo(parent: DirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): string

Move an entry to a different location on the file system. It is an error to try to:

  • move a directory inside itself or to any child at any depth;
  • move an entry into its parent if a name different from its current one isn't provided;
  • move a file to a path occupied by a directory;
  • move a directory to a path occupied by a file;
  • move any element to a path occupied by a directory which is not empty.
    • A move of a file on top of an existing file must attempt to delete and replace that file. A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.

      Parameters

      Returns

      string

    public remove(successCallback: VoidCallback, errorCallback?: ErrorCallback)

    Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to attempt to delete the root directory of a filesystem.

    Parameters

    • successCallback: VoidCallback

      A callback that is called on success.

    • errorCallback?: ErrorCallback optional

      A callback that is called when errors happen.

    public toURL(): string

    Returns a URL that can be used to identify this entry. Unlike the URN defined in [FILE-API-ED], it has no specific expiration; as it describes a location on disk, it should be valid at least as long as that location exists.

    Returns

    string