|
 |
The File object represents a file in a DataWeb Application. By using the File object and its associated methods, you can create and delete files in your Web, as well as extract and change the data within the files of your Application. (Note that only users with Designer permissions or higher can run scripts which call methods on the File and Folder objects.)
Constructor
[new]
File(path) |
Constructs and returns a new File object instance.
It does not create a file on the file system. |
|
Instance
Properties
name |
Holds the name of the file object. |
path |
Holds the path of the file. |
|
Instance
Methods
append |
Appends a string to a file.
|
copy |
Copies a specified file from one location to another.
|
exists
|
Checks the file system hierarchy for the existence of a file.
|
getBaseName
|
Returns the name of a file without its extension.
|
getDateCreated |
Returns
a Date object representing the date/time when
the file was created. |
getDateModified |
Returns
a Date object representing the date/time when
the file was last modified. |
getExtension |
Returns
the extension of a file.
|
getFolderPath |
Returns
the path of the folder that
contains the file. |
getSize |
Returns
the size of the file in bytes. |
move |
Moves
a file from one location to another.
|
read |
Opens
the file and reads its contents into a string.
Returns the string. |
remove |
Removes
the file from the file system. |
rename |
Renames a file.
|
write |
Writes
string or an array of strings to a file.
|
|
Prototype
Methods
exists |
Checks to see if a file exists in the file system.
|
create |
Creates a file in the file system hierarchy as well as a corresponding File object instance.
|
createNew |
Creates a file in the file system hierarchy as well as a corresponding File object instance. Unlike the case with create(), if the referenced object exists, an error is thrown. |
getExisting |
A File object instance is created and returned if the file specified by path exists. If the file does not exist in the file system hierarchy, an error is thrown. |
remove |
Removes the file specified by path from the file system hierarchy.
|
|
Constructor Example
var fl = new File("/AddressBook/default.view");
Prototype Method Example
var fl = File.create("/temp.ws");
|