FileSystemEntry

Description

Variables Summary

Classes Summary

Variables

nextId

Counter to give every entry a unique id

Classes

Constructor

FileSystemEntry

path string
The path for this entry.
fileSystem FileSystem
The file system associated with this entry.
Properties
Methods

Properties

_fileSystem

Parent file system.

_isDirectory

Whether or not the entry is a directory

_isFile

Whether or not the entry is a file

_name

The name of this entry.

_parentPath

The parent of this entry.

_path

The path of this entry.

_stat

Cached stat object for this file.

_watchedRoot

Cached copy of this entry's watched root

_watchedRootFilterResult

Cached result of _watchedRoot.filter(this.name, this.parentPath).

Methods

Private

_clearCachedData

Clear any cached data for this entry

_isWatched

Determines whether or not the entry is watched.

relaxed optional boolean
If falsey, the method will only return true if the watched root is fully active. If true, the method will return true if the watched root is either starting up or fully active.
Returns: boolean
Private

_setPath

Update the path for this entry

newPath String
Private

_visitHelper

Private helper function for FileSystemEntry.visit that requires sanitized options.

stats FileSystemStats
- the stats for this entry
visitedPaths {string: boolean}
- the set of fullPaths that have already been visited
visitor function(FileSystemEntry): boolean
- A visitor function, which is applied to descendent FileSystemEntry objects. If the function returns false for a particular Directory entry, that directory's descendents will not be visited.
options {maxDepth: number,maxEntriesCounter: {value: number}}
callback optional function(?string)
Callback with single FileSystemError string parameter.

exists

Check to see if the entry exists on disk. Note that there will NOT be an error returned if the file does not exist on the disk; in that case the error parameter will be null and the boolean will be false. The error parameter will only be truthy when an unexpected error was encountered during the test, in which case the state of the entry should be considered unknown.

callback function (?string,boolean)
Callback with a FileSystemError string or a boolean indicating whether or not the file exists.

moveToTrash

Move this entry to the trash. If the underlying file system doesn't support move to trash, the item is permanently deleted.

callback optional function (?string)
Callback with a single FileSystemError string parameter.

rename

Rename this entry.

newFullPath string
New path & name for this entry.
callback optional function (?string)
Callback with a single FileSystemError string parameter.

stat

Returns the stats for the entry.

callback function (?string,FileSystemStats=)
Callback with a FileSystemError string or FileSystemStats object.

toString

Helpful toString for debugging purposes

unlink

Permanently delete this entry. For Directories, this will delete the directory and all of its contents. For reversible delete, see moveToTrash().

callback optional function (?string)
Callback with a single FileSystemError string parameter.

visit

Visit this entry and its descendents with the supplied visitor function. Correctly handles symbolic link cycles and options can be provided to limit search depth and total number of entries visited. No particular traversal order is guaranteed; instead of relying on such an order, it is preferable to use the visit function to build a list of visited entries, sort those entries as desired, and then process them. Whenever possible, deep filesystem traversals should use this method.

visitor function(FileSystemEntry): boolean
- A visitor function, which is applied to this entry and all descendent FileSystemEntry objects. If the function returns false for a particular Directory entry, that directory's descendents will not be visited.
options optional {maxDepth: number=, maxEntries: number=}
callback optional function(?string)
Callback with single FileSystemError string parameter.