Chapter 4. Working with Files
The FileEntry
Files in the sandboxed filesystem are represented by the FileEntry interface. A FileEntry contains the types of properties and
methods one would expect from a standard filesystem.
Properties
isFileBoolean. True if the entry is a file.
isDirectoryBoolean. True if the entry is a directory.
nameDOMString. The name of the entry, excluding the path leading to it.
fullPathDOMString. The full absolute path from the root to the entry.
filesystemFileSystem. The filesystem on which the entry resides.
Methods
getMetadata (successCallback, opt_errorCallback)Look up metadata about this entry.
moveTo (parentDirEntry, opt_newName, opt_successCallback, opt_errorCallback)Move an entry to a different location on the filesystem.
copyTo (parentDirEntry, opt_newName, opt_successCallback, opt_errorCallback)Copies an entry to a different parent on the filesystem. Directory copies are always recursive. It is an error to copy a directory inside itself or to copy it into its parent if a new name is not provided.
toURL ();Returns a
filesystem:URL that can be used to identify this file. See Chapter 7.remove (successCallback, opt_errorCallback)Deletes a file or directory. It is an error to attempt to delete the root directory of a filesystem or a directory that is not empty.
getParent (successCallback, opt_errorCallback)Return the parent
DirectoryEntrycontaining this entry. If this entry is the root directory, its parent is itself.createWriter (successCallback, opt_errorCallback) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access