n getModificationDateObj()??”Returns the JavaScript object that represents the date a specified
file or folder was last modified.
n getSize()??”Gets the size of a specified file.
n read()??”Reads a text file into a string for examination. This function also takes one argument,
the filename.
n write()??”Outputs a string to a text file. This function has three arguments; the first two??”the
name of the file to be created and the string to be written??”are required. The third, the mode,
must be the word append. This argument, if used, causes the string to be added to the end of the
existing text file; otherwise, the file is overwritten.
n remove()??”Places the referenced file in the Recycling Bin (Windows) or Trash (Macintosh)
without requesting confirmation.
The following JavaScript function, which could be included in any Dreamweaver extension, uses DWfile
to determine whether theFile, named in a passed argument, exists. If it does, the contents are read and
presented in an alert box; if theFile doesn??™t exist, the function creates it and outputs a brief message.
function fileWork(theFile) {
var isFile = DWfile.exists(theFile); // does theFile exist?
if (isFile) {
alert(DWfile.read(theFile)); // yes: display it in an alert box
}
else { // no: create it and display msg
DWfile.
Pages:
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778