Function |
Description |
---|---|
Returns information about a file |
|
Reads data from a file |
|
Writes data to a file |
Returns information
about a file. When infotype is set to EXISTS
,
the function returns the whole path to the file if it exists or
an empty string if it does not exist. Is infotype set
to SIZE
, the size of the
file will be returned or an empty string if the file does not exist.
Be aware that you have to double the backslashes in JavaScript environments because the backslash is used as escape sequence.
string uFileInfo(file [, infotype])
The file to investigate
The kind of information to get. Default is EXISTS
.
Getting file information
uFileInfo("C:\\windows\\notepad.exe") // returns C:\windows\notepad.exe
uFileInfo("C:\\windows\\notepad.exe","SIZE") // returns 68608
Reads data from a file
string uFileRead(URL [, bytes] [, offset] [, encoding])
URL specifying the source to read
Number of bytes to read. Default is 0, means the whole file
Number of bytes to skip from the beginning of the file. Default is 0.
The encoding of the data source. Default encoding is ISO8859-1
Accessing local files
uFileRead("c:\\myFile.txt")
uFileRead("/home/testuser/myfile.txt")
uFileRead("file:///c:/ myFile.txt")
Read files from a Windows share
uFileRead("\\\\fileserver\\freeShare\\testfile.txt")
Read the content of a file via HTTP and HTTPS
uFileRead("http://http://www.google.com/search?hl=en&q pizza&btnG=Google+Search") uFileRead("https://http://www.google.com/search?hl=en&q=pizza&btnG=Google+Search")
Read the content of a file via FTP
uFileRead("ftp://myUser:myPasswd@myServer/data/myFile.txt")
Writes data to a file. If no URL is given, the data is written to a file write.log in the Sybase ETL log directory.
string uFileWrite(data [, URL] [, append] [, encoding])
The data to be written
URL for file access and location
Flag (0/1) indicating if the data should be appended or not
The encoding of the target file
Write data to a file via CIFS
uFileWrite("hello", "//myServer/myShare/data/test.txt")