function attrib ( url, attributes_to_set,
attributes_values )
Parameters
url.
URL
object. URL toward the directory to list
attributes_to_set. UInt32. Bit mask of files
attributes to set choosen from kFilesAttr??? values.
attributes_values. UInt32. Bit mask of files
attributes values choosen from
kFilesAttr??? values.
function dir ( url, re )
returns an Array of
VFS.Metadata
objects.
Parameters
url.
URL
object. URL toward the directory to list
re. RegExp object. Only entries matching this regular
expression are returned. If omitted, all entires are
returned
Returns 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.
Examples
Example 1.
Makes a temporay directory and save a file called myfile.txt
within:
var my_temp_dir = VFS.get_temporary_dir_url ();
VFS.save_text (my_temp_dir.compose('myfile.txt'), 'the
file content');
Returns 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.
NB: This method is deprecated
because it had to let the empty file there to avoid
synchronization problems, but the empty file was never deleted.
Use
get_temporary_file_urlandget_temporary_dir_urlinstead.
Examples
Example 1.
Prints 10 different temporary file names:
for (var idxtfn=0; idxtfn<10; ++idxtfn)
log ( VFS.get_temporary_file_name ()
);
Returns 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.
Examples
Example 1.
Prints 10 different temporary file names with the '.txt'
extension:
for (var idxtfn=0; idxtfn<10; ++idxtfn)
log ( VFS.get_temporary_file_url
('.txt') );
function load_text (url, encoding, detect, at_most)
returns a String
Parameters
url.
URL
object. URL pointing to the text file to read.
encoding. Encoding string. Encoding to use (see
'detect'). If undefined or omitted, load_text uses default
system encoding.
detect. Boolean. True when signatures detection is
enabled (currently Unicode signatures), hence encoding is a
'default'. False to ignore signatures, therefore, encoding is
then always used. If undefined or omitted, true is assumed.
at_most. Integer. Number of bytes which you accept to
read from the file. If undefined or omitted, the whole file is
read.
function save_text ( url, text, encoding, save_signature,
creation_flags)
Parameters
url.
URL
object. URL pointing where to save the text.
text. String. Text to save
encoding. Encoding string. Encoding to use to save the
text. If undefined or omitted, default system encoding is used.
save_signature. Boolean. True when the appropriate
signature for
encoding should be written. If undefined or omitted,
true is assumed.
creation_flags. Integer. A bitwise-OR of VFS.k???
constants. If undefined or omitted,
VFS.kCreateNew|VFS.kReadWrite|VFS.kShareNone is
assumed.
function set_dates ( url, last_access, last_update,
creation)
Parameters
url.
URL
object. URL pointing to the file.
last_access. Date. Last access date to item. If
undefined or omitted, this date is not set for the file
last_update. Date. Date of last modification of the file.
If undefined or omitted, this date is not set for the file
creation. Date. Date of creation of the file. If
undefined or omitted, this date is not set for the file
Set 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.
Note that some file systems store only a "last_update"
date. Each file system store dates with a specific
precision, some use 2-seconds precision (FAT), some use real
tight precision (below the microsecond, NTFS). JavaScript Date
objects have a built-in precision at the millisecond, you might
thus be unable to repesent the dates of NTFS with
exactness.
Examples
Example 1.
Set all the dates to current date for imaginary file
"/tmp/mytest.txt" :
var my_date = new Date(); VFS.set_dates ("/tmp/mytest.txt", my_date, my_date,
my_date);
Example 2.
Implements the famous "touch" function in ECMerge :
function touch (url) {
VFS.set_dates (url, undefined, new
Date());
}