Creates and returns a new File object referring to a given file system location.
File
Represents a file in the local file system in a platform-independent manner.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
| String | readonly | The full path name for the referenced file in URI notation. | |
| Boolean | readonly | If true, the object refers to a file system alias or shortcut. | |
| Date | readonly | The creation date of the referenced file, or null if the object does not refer to a file on disk. | |
| String | readonly | In Mac OS, the file creator as a four-character string. In Windows or UNIX, value is "????". | |
| String | readonly | The localized name of the referenced file, without the path specification. | |
| String | read/write | Gets or sets the encoding for subsequent read/write operations. | |
| Boolean | readonly | When true, a read attempt caused the current position to be at the end of the file, or the file is not open. | |
| String | read/write | A string containing a message describing the most recent file system error. | |
| Boolean | readonly | If true, this object refers to a file or file-system alias that actually exists in the file system. | |
| static | String | readonly | The name of the file system. |
| String | readonly | The platform-specific full path name for the referenced file. | |
| String | readonly | The full path name for the referenced file in URI notation. | |
| Number | read/write | The size of the file in bytes. | |
| String | read/write | How line feed characters are written in the file system. | |
| Date | readonly | The date of the referenced file's last modification, or null if the object does not refer to a file on the disk. | |
| String | readonly | The file name portion of the absolute URI for the referenced file, without the path specification. | |
| Folder | readonly | The Folder object for the folder that contains this file. | |
| String | readonly | The path portion of the absolute URI for the referenced file, without the file name. | |
| Boolean | read/write | When true, prevents the file from being altered or deleted. | |
| String | readonly | The path name for the object in URI notation, relative to the current folder. | |
| String | readonly | The file type as a four-character string. |
Methods
Changes the path specification of the referenced file.
Closes this open file.
Copies this object’s referenced file to the specified target location.
Makes this file a file-system alias or shortcut to the specified file.
Decodes a UTF-8 encoded string as required by RFC 2396, and returns the decoded string.
Encodes a string as required by RFC 2396, and returns the encoded string.
Executes or opens this file using the appropriate application, as if it had been double-clicked in a file browser.
Retrieves and returns the path for this file, relative to the specified base path, in URI notation.
Reports whether a given encoding is available.
Opens the referenced file for subsequent read/write operations. The method resolves any aliases to find the file.
Opens a dialog so the user can select one or more files to open.
Opens the built-in platform-specific file-browsing dialog, in which the user can select an existing file or files, and creates new File objects to represent the selected files.
Reads the contents of the file, starting at the current position.
Reads a single text character from the file at the current position.
Reads a single line of text from the file at the current position.
Deletes the file associated with this object from disk immediately, without moving it to the system trash.
Renames the associated file.
Attempts to resolve the file-system alias or shortcut that this object refers to.
Opens a dialog so the user can select a file name to save to.
Opens the built-in platform-specific file-browsing dialog, in which the user can select an existing file location to which to save information, and creates a new File object to represent the selected file.
Seeks to a given position in the file.
Retrieves the current position as a byte offset from the start of the file.
Creates and returns a serialized string representation of this object.
Converts this object to a string.
Writes the specified text to the file at the current position.
Writes a string to the file at the current position and appends a line-feed sequence.
Object of 2
Properties elsewhere that hold a File.
Parameter of 2
Method parameters that accept a File.
Return 6
Methods that return a File.