![]() |
|
VFS object
VFS global object. SyntaxA VFS global object is created for you and only this object can exist in the application. It is named VFS and is globally accessible. Parametersnone. Property Ofglobal name space. Implemented InECMerge 2.1 DescriptionThe VFS object let you realize a few basic operations on files and folders currently. Files and folders are pointed to by URL objects. Properties
Methods
attrib
Examplessee functions samples. See Also
Method attribSyntaxfunction attrib ( url, attributes_to_set, attributes_values ) Parametersurl.
URL
object. URL toward the directory to list
Method OfVFS object. Implemented InECMerge 2.1 DescriptionModifies the attributes of a file. Attributes which are not present in the parameter attributes_to_set are not affected by attrib execution. ExamplesExample 1.Mark a file as read-write: VFS.attrib ("c:\\myfile.txt", VFS.kFileAttrReadWrite, VFS.kFileAttrReadWrite); See Also
Method dirSyntaxfunction dir ( url, re )
Parametersurl.
URL
object. URL toward the directory to list
Method OfVFS object. Implemented InECMerge 2.1 DescriptionLists the directory designed by url and returns the entries as an Array of metadata. ExamplesExample 1.Dumps as XML the metadata of all the elements under the root of the file system:
var metadata_array = VFS.dir ("/");
See Also
Method get_temporary_dir_urlSyntaxfunction get_temporary_dir_url ( with_ext )
Parameterswith_ext. If defined, the directory's name will end with this string Method OfVFS object. Implemented InECMerge 2.2 DescriptionReturns the name for a temporary file. Usually an empty file is created with this name during the execution of this call, to avoid another call returning the same value. ExamplesExample 1.Makes a temporay directory and save a file called myfile.txt within:
var my_temp_dir = VFS.get_temporary_dir_url ();
See Also
Method get_temporary_file_nameSyntaxfunction get_temporary_file_name ( )
Parametersnone. Method OfVFS object. Implemented InECMerge 2.1
DescriptionReturns the name for a temporary file. Usually an
empty file is created with this name during the execution
of this call, to avoid another call returning the same value.
ExamplesExample 1.Prints 10 different temporary file names:
for (var idxtfn=0; idxtfn<10; ++idxtfn)
See Also
Method get_temporary_file_urlSyntax
function get_temporary_file_url ( with_ext )
Parameterswith_ext. If defined, the file's name will end with this string Method OfVFS object. Implemented InECMerge 2.2 DescriptionReturns the name for a temporary file. Usually an empty file is created with this name during the execution of this call, to avoid another call returning the same value. ExamplesExample 1.Prints 10 different temporary file names with the '.txt' extension:
for (var idxtfn=0; idxtfn<10; ++idxtfn)
See Also
Method load_textSyntaxfunction load_text (url, encoding, detect, at_most)
Parametersurl.
URL
object. URL pointing to the text file to read.
Method OfVFS object. Implemented InECMerge 2.1 DescriptionReads a text file and returns its content as a string. ExamplesExample 1.Displays a message with the content of a file: alert ( VFS.load_text ( "/etc/hosts" ) ); See Also
Method save_textSyntaxfunction save_text ( url, text, encoding, save_signature, creation_flags) Parametersurl.
URL
object. URL pointing where to save the text.
Method OfVFS object. Implemented InECMerge 2.1 DescriptionSaves a text to a URL location, in a given encoding. ExamplesExample 1.Saves a text file:
var text = "hello world!";
See Also
Method set_datesSyntaxfunction set_dates ( url, last_access, last_update, creation) Parametersurl.
URL
object. URL pointing to the file.
Method OfVFS object. Implemented InECMerge 2.2 DescriptionSet the dates for a file. Most file system supports
three dates: the creation date, the last modification date and
last access date, this function let you set these dates with
arbitrary values.
ExamplesExample 1.Set all the dates to current date for imaginary file "/tmp/mytest.txt" :
var my_date = new Date();
Example 2.Implements the famous "touch" function in ECMerge :
function touch (url) {
See Also
Method statSyntaxfunction stat ( url )
Parametersurl. URL object. URL pointing to the file. Method OfVFS object. Implemented InECMerge 2.2.109 DescriptionReturns the metadata for a single item pointed to by a URL. ExamplesExample 1.Displays the last update time for a FTP file: alert (VFS.stat("ftp://myserver.domain.com/a-file.txt")); See Also
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||