Constructor
new NodeFile(path)
Instantiate a real file represented by the filepath provided.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The filepath. |
- Source:
Classes
Methods
(async) copy(newDir, optionsopt) → {Promise.<(IFile|null)>}
Move this file or directory under a new directory.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newDir |
IFile | The target directory. | |
options |
CopyOptions |
<optional> |
The options |
- Source:
Throws:
IOException Thrown if there is an IO error.
Returns:
The copied file. Use this file for subsequent operations instead of the original.
- Type
- Promise.<(IFile|null)>
(async) createDirectory(dirName) → {Promise.<IFile>}
Create a directory under this directory.
Parameters:
Name | Type | Description |
---|---|---|
dirName |
string | The name of the new directory. |
- Source:
Returns:
The newly created directory.
- Type
- Promise.<IFile>
(async) createFile(filename) → {Promise.<IFile>}
Create a file under this directory.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string | The name of the new file. |
- Source:
Throws:
IOException Thrown if there is an IO error.
Returns:
The newly created file.
- Type
- Promise.<IFile>
(async) delete() → {Promise.<boolean>}
Delete this file or directory.
- Source:
Returns:
True if deletion is successful.
- Type
- Promise.<boolean>
(async) exists() → {Promise.<boolean>}
True if file or directory exists.
- Source:
Returns:
True if exists
- Type
- Promise.<boolean>
(async) getChild(filename) → {Promise.<(IFile|null)>}
Get the file or directory under this directory with the provided name.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string | The name of the file or directory. |
- Source:
Returns:
The child
- Type
- Promise.<(IFile|null)>
(async) getChildrenCount() → {Promise.<number>}
Get the count of files and subdirectories
- Source:
Returns:
The number of files and subdirectories
- Type
- Promise.<number>
getDisplayPath() → {string}
Get the display path on the physical disk. For java this is the same as the filepath.
- Source:
Returns:
The display path.
- Type
- string
(async) getInputStream() → {Promise.<RandomAccessStream>}
Get a stream for reading the file.
- Source:
Throws:
FileNotFoundException
Returns:
The stream to read from.
- Type
- Promise.<RandomAccessStream>
(async) getLastDateModified() → {Promise.<number>}
Get the last modified date on disk.
- Source:
Returns:
The last date modified
- Type
- Promise.<number>
(async) getLength() → {Promise.<number>}
Get the size of the file on disk.
- Source:
Returns:
The file size
- Type
- Promise.<number>
getName() → {string}
Get the name of this file or directory.
- Source:
Returns:
The name of this file or directory.
- Type
- string
(async) getOutputStream() → {Promise.<RandomAccessStream>}
Get a stream for writing to this file.
- Source:
Throws:
FileNotFoundException
Returns:
The stream to write to.
- Type
- Promise.<RandomAccessStream>
(async) getParent() → {Promise.<IFile>}
Get the parent directory of this file or directory.
- Source:
Returns:
The parent directory.
- Type
- Promise.<IFile>
getPath() → {string}
Get the path of this file. For java this is the same as the absolute filepath.
- Source:
Returns:
The path
- Type
- string
(async) isDirectory() → {Promise.<boolean>}
True if this is a directory.
- Source:
Returns:
True if directory
- Type
- Promise.<boolean>
(async) isFile() → {Promise.<boolean>}
True if this is a file.
- Source:
Returns:
True if file.
- Type
- Promise.<boolean>
(async) listFiles() → {Promise.<Array.<IFile>>}
List all files under this directory.
- Source:
Returns:
The list of files.
- Type
- Promise.<Array.<IFile>>
(async) mkdir() → {Promise.<boolean>}
Create this directory under the current filepath.
- Source:
Returns:
True if created.
- Type
- Promise.<boolean>
(async) move(newDir, optionsopt) → {Promise.<IFile>}
Move this file or directory under a new directory.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newDir |
IFile | The target directory. | |
options |
MoveOptions |
<optional> |
The options |
- Source:
Returns:
The moved file. Use this file for subsequent operations instead of the original.
- Type
- Promise.<IFile>
(async) renameTo(newFilename) → {Promise.<boolean>}
Rename the current file or directory.
Parameters:
Name | Type | Description |
---|---|---|
newFilename |
string | The new name for the file or directory. |
- Source:
Returns:
True if successfully renamed.
- Type
- Promise.<boolean>
reset()
Reset cached properties
- Source:
toString() → {string}
Returns a string representation of this object
- Source:
Returns:
The string
- Type
- string