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 entire path to the file, if it exists,
or an empty string if it does not. If infotype set
to SIZE
, the size of the
file is returned. If the file does not exist, an empty string is
returned.
Use double 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
.
Get 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, which means the entire 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.
Access 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 Common Internet File System (CIFS):
uFileWrite("hello", "//myServer/myShare/data/test.txt")