File

Description

Represents a file in the local file system in a platform-independent manner.

Properties

absoluteURI readonly The full path name for the referenced file in URI notation.
alias readonly If true, the object refers to a file system alias or shortcut.
created readonly The creation date of the referenced file, or null if the object does not refer to a file on disk.
creator readonly In Mac OS, the file creator as a four-character string. In Windows or UNIX, value is “????”.
displayName readonly The localized name of the referenced file, without the path specification.
encoding readonly Gets or sets the encoding for subsequent read/write operations.
eof readonly When true, a read attempt caused the current position to be at the end of the file, or the file is not open.
error readonly A string containing a message describing the most recent file system error.
exists readonly If true, this object refers to a file or file-system alias that actually exists in the file system.
fsName readonly The platform-specific full path name for the referenced file.
fullName readonly The full path name for the referenced file in URI notation.
hidden readonly When true, the file is not shown in the platform-specific file browser.
length readonly The size of the file in bytes.
lineFeed readonly How line feed characters are written in the file system.
modified readonly The date of the referenced file’s last modification, or null if the object does not refer to a file on the disk.
name readonly The file name portion of the absolute URI for the referenced file, without the path specification.
parent readonly The Folder object for the folder that contains this file.
path readonly The path portion of the absolute URI for the referenced file, without the file name.
readonly readonly When true, prevents the file from being altered or deleted.
relativeURI readonly The path name for the object in URI notation, relative to the current folder.
type readonly The file type as a four-character string.

Static Properties

fs readonly The name of the file system.

Constructors

File readonly Creates and returns a new File object referring to a given file system location.

Methods

changePath readonly Changes the path specification of the referenced file.
close readonly Closes this open file.
copy readonly Copies this object?s referenced file to the specified target location.
createAlias readonly Makes this file a file-system alias or shortcut to the specified file.
execute readonly Executes or opens this file using the appropriate application, as if it had been double-clicked in a file browser.
getRelativeURI readonly Retrieves and returns the path for this file, relative to the specified base path, in URI notation.
open readonly Opens the referenced file for subsequent read/write operations. The method resolves any aliases to find the file.
openDlg readonly 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.
read readonly Reads the contents of the file, starting at the current position.
readch readonly Reads a single text character from the file at the current position.
readln readonly Reads a single line of text from the file at the current position.
remove readonly Deletes the file associated with this object from disk immediately, without moving it to the system trash.
rename readonly Renames the associated file.
resolve readonly Attempts to resolve the file-system alias or shortcut that this object refers to.
saveDlg readonly 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.
seek readonly Seeks to a given position in the file.
tell readonly Retrieves the current position as a byte offset from the start of the file.
toSource readonly Creates and returns a serialized string representation of this object.
toString readonly Converts this object to a string.
write readonly Writes the specified text to the file at the current position.
writeln readonly Writes a string to the file at the current position and appends a line-feed sequence.

Static Methods

decode readonly Decodes a UTF-8 encoded string as required by RFC 2396, and returns the decoded string.
encode readonly Encodes a string as required by RFC 2396, and returns the encoded string.
isEncodingAvailable readonly Reports whether a given encoding is available.
openDialog readonly Opens a dialog so the user can select one or more files to open.
saveDialog readonly Opens a dialog so the user can select a file name to save to.