appendBRD
Appends the contents of file-name-1
to the contents of file-name-2
. If file-name-2
does not exist, then the file-name-2
is created and the contents of file-name-1
are copied into it. This is almost identical to the appendFile
operator, except that it correctly deals with a BRD’s header line.
Used in the following format, where file-name-1
and file-name-2
must be a string:
appendBrd(file-name-1, file-name-2)
file-name-1.appendBrd(file-name-2)
The return value type is null.
Examples
appendBrd('data1.brd', 'data2.brd')
'data1.brd'.appendBrd('data2.brd')
appendFile
Appends the contents of file-name-1
to the contents of file-name-2
. If file-name-2
does not exist, then the file-name-2
is created and the contents of file-name-1
are copied into it.
Used in the following format, where file-name-1
and file-name-2
must be a string:
appendFile(file-name-1, file-name-2)
file-name-1.appendFile(file-name-2)
The return value type is null.
Examples
appendFile('file1.txt','file2.txt')
'file1.txt'.appendFile('file2.txt')
deleteFile
Delete file file-name
. If file-name does not exist, an exception will be thrown, which should result in a node error.
Used in the following format, where file-name
must be a string:
deleteFile(file-name)
file-name.delete()
The return value type is null.
Examples
deleteFile("src.txt")
"src.txt".deleteFile()
moveFile
Moves old-file
to new-file
. If new-file
already exists, it is overwritten.
Used in the following format, where old-file
and new-file
must be a string:
moveFile(old-file, new-file)
old-file.move(new-file)
The return value type is null.
Examples
moveFile("src.txt","dst.txt")
"src.txt".moveFile("dst.txt")
Stat
Returns a list containing 3 long integers; the first one is the size of the specified file in bytes, the second one is the file last modification time (as an epoch-time representation), and the third one is the file creation time (also as an epoch-time, see dateTime).
Used in the following format, where file-name
must be a string:
stat(file-name)
file-name.stat()
file-name
does not exist, or if there are any other errors retrieving information about the file from the operating system.Examples
stat("foo.txt")
"foo.txt".stat()
touchFile
If file-name
exists, its access and modification times are updated to the current time. If file-name
does not exist, an empty file is created.
Used in the following format, where file-name
must be a string:
touchFile(file-name)
file-name.touchFile()
The return value type is null.
Examples
touchFile("foo.txt")
"foo.txt".touchFile()
truncateFile
If file-name
exists, the file is truncated (set to zero length). If file-name
does not exist, an error is thrown.
Used in the following format, where file-name
must be a string:
truncateFile(file-name)
file-name.truncateFile()
The return value type is null.
Examples
truncateFile("foo.txt")
"foo.txt".truncateFile()