Qorus Integration Engine  3.1.0.p16
 All Classes Namespaces Files Functions Variables Groups Pages
fs-v1.1.qsd File Reference

provides access to the filesystem More...

Functions

nothing fs.init ()
 initalizes the system fs service
 
nothing fs.rename (string source, string target, softbool man=False)
 rename/move a file More...
 
nothing fs.rename_conn (string conn_src, string source, string conn_tgt, string target, softbool man=False)
 rename/move a file More...
 
nothing fs.copy (string source, string target)
 copy a file More...
 
nothing fs.copy_conn (string conn_src, string source, string conn_tgt, string target)
 copy a file More...
 
nothing fs.del (string path)
 delete a file More...
 
nothing fs.del_conn (string conn, string path)
 delete a file More...
 
list fs.ls (string path, *string regex, *softint reopts, *string encoding)
 lists files in the given directory More...
 
list fs.ls_conn (string conn, *string path, *string regex, *softint reopts, *string encoding)
 lists files in the given directory More...
 
binary fs.get_file_bin (string path)
 returns the given file as binary data More...
 
binary fs.get_file_bin_conn (string conn, string path)
 returns the given file as binary data More...
 
string fs.get_file_string (string path, *string encoding)
 returns the given file as string data More...
 
string fs.get_file_string_conn (string conn, string path, *string encoding)
 returns the given file as string data More...
 
nothing fs.write_file (string path, data data, int mode=0664, *string encoding)
 writes the input data to the given location More...
 
nothing fs.write_file_conn (string conn, string path, data data, int mode=0664, *string encoding)
 writes the input data to the given location More...
 
*hash fs.hstat_file (string path)
 runs Qore::hstat() on a file target and returns the result More...
 
*hash fs.hstat_file_conn (string conn, string path)
 runs Qore::hstat() on a file target and returns the result More...
 

Detailed Description

provides access to the filesystem

The streams in the following table are provided.

Note
See Work with Data Streaming for easy to use functionality.

Supported Data Streams

Stream Dir HTTP Method Args Description
get-file out GET path=string
rename=string
del=boolean
timeout=ms
[block=integer]
Reads a file and streams the raw data as binary data to the sender, where it can be converted to a string and encoded with a particular encoding if necessary. Requires FILESYSTEM-CONTROL or FILESYSTEM-READ permissions to access
get-xml-data out GET path=string
rename=string
del=boolean
element=string
timeout=ms
[encoding=string]
[block=integer]
Reads an XML file and streams records to the sender. Requires FILESYSTEM-CONTROL or FILESYSTEM-READ permissions to access
get-csv-data out GET path=string
rename=string
del=boolean
timeout=ms
[block=integer]
csvutil=hash see CsvUtil::CsvFileIterator::constructor() for details the structure of this hash]
Reads a CSV or other structured data file parsable with CsvUtil::CsvFileIterator and streams records to the sender. Requires FILESYSTEM-CONTROL or FILESYSTEM-READ permissions to access
get-fixed-data out GET path=string
rename=string
del=boolean
timeout=ms
[block=integer]
fixedlengthutil=hash with "spec" and "opts" keys; see FixedLengthUtil::FixedLengthFileIterator::constructor() for details on the meanings of the values of these hash keys]
Reads a fixed-length file parsable with FixedLengthUtil::FixedLengthFileIterator and streams records to the sender. Requires FILESYSTEM-CONTROL or FILESYSTEM-READ permissions to access
put-file in POST path=string
timeout=ms
[target_path=string]
[mode=int]
[encoding=string]
Accepts streamed string or binary data and writes the data to the given file

Function Documentation

nothing fs.copy ( string  source,
string  target 
)

copy a file

Parameters
sourcethe source path
targetthe target path

If any errors occur, an exception is thrown

Exceptions
COPY-ERRORcannot stat() source file
nothing fs.copy_conn ( string  conn_src,
string  source,
string  conn_tgt,
string  target 
)

copy a file

Parameters
conn_srcthe source user connection name
sourcethe source path, relative to conn_src
conn_tgtthe target user connection name
targetthe target path, relative to conn_tgt

If any errors occur, an exception is thrown

Exceptions
CONNECTION-ERRORthe given connection is not known
COPY-ERRORcannot stat() source file
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
nothing fs.del ( string  path)

delete a file

Parameters
paththe path of the file to delete

If any errors occur, an exception is thrown

Exceptions
UNLINK-ERRORerror removing the file
nothing fs.del_conn ( string  conn,
string  path 
)

delete a file

Parameters
connan user connection name
paththe path of the file to delete, relative to conn

If any errors occur, an exception is thrown

Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
UNLINK-ERRORerror removing the file
binary fs.get_file_bin ( string  path)

returns the given file as binary data

Parameters
paththe path of the file to retrieve
Returns
the file data as binary data
binary fs.get_file_bin_conn ( string  conn,
string  path 
)

returns the given file as binary data

Parameters
connan user connection name
paththe path of the file to retrieve, relative to conn
Returns
the file data as binary data
Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
string fs.get_file_string ( string  path,
*string  encoding 
)

returns the given file as string data

Parameters
paththe path of the file to retrieve
encodingthe encoding of the source file
Returns
the file data as a string
string fs.get_file_string_conn ( string  conn,
string  path,
*string  encoding 
)

returns the given file as string data

Parameters
connanuser connection
paththe path of the file to retrieve
encodingthe encoding of the source file
Returns
the file data as a string
Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
* hash fs.hstat_file ( string  path)

runs Qore::hstat() on a file target and returns the result

Parameters
paththe path of the file to stat
Returns
NOTHING or a hash of file status values for the path argument
See Also
Qore::hstat()
* hash fs.hstat_file_conn ( string  conn,
string  path 
)

runs Qore::hstat() on a file target and returns the result

Parameters
conna user connection; must be a filesystem connection
paththe path of the file to stat
Returns
NOTHING or a hash of file status values for the path argument
Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
See Also
Qore::hstat()
list fs.ls ( string  path,
*string  regex,
*softint  reopts,
*string  encoding 
)

lists files in the given directory

Parameters
paththe path to list
regexan optional regex to filter the results
reoptsoption regular expression options; see Regular Expression Constants for possible values
encodingthe encoding of the filesystem string data
Returns
a list of file status value hashes for each matched file plus a "name" key with the file or directory name and optionally a "link" key for symbolic link targets
Exceptions
DIR-ERRORdirectory does not exist
list fs.ls_conn ( string  conn,
*string  path,
*string  regex,
*softint  reopts,
*string  encoding 
)

lists files in the given directory

Parameters
connan user connection name
paththe path to list, relative to conn. It can be empty, then the toplevel connection directory is listed.
regexan optional regex to filter the results
reoptsoption regular expression options; see Regular Expression Constants for possible values
encodingthe encoding of the filesystem string data
Returns
a list of file status value hashes for each matched file plus a "name" key with the file or directory name and optionally a "link" key for symbolic link targets
Exceptions
CONNECTION-ERRORthe given connection is not known
DIR-ERRORdirectory does not exist
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
nothing fs.rename ( string  source,
string  target,
softbool  man = False 
)

rename/move a file

Parameters
sourcethe source path
targetthe target path
manrename the file manually by copying the file's data and then deleting the source file, this is sometimes necessary on some OSes when renaming files across filesystem boundaries

If any errors occur, an exception is thrown

Exceptions
RENAME-ERRORcannot stat() source file
nothing fs.rename_conn ( string  conn_src,
string  source,
string  conn_tgt,
string  target,
softbool  man = False 
)

rename/move a file

Parameters
conn_srcthe source user connection name
sourcethe source path, relative to conn_src
conn_tgtthe target user connection name
targetthe target path, relative to conn_tgt
manrename the file manually by copying the file's data and then deleting the source file, this is sometimes necessary on some OSes when renaming files across filesystem boundaries

If any errors occur, an exception is thrown

Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection
RENAME-ERRORcannot stat() source file
nothing fs.write_file ( string  path,
data  data,
int  mode = 0664,
*string  encoding 
)

writes the input data to the given location

Parameters
paththe path of the file to write
datathe file data to write
modethe file's creation mode
encodingthe encoding of the target file
nothing fs.write_file_conn ( string  conn,
string  path,
data  data,
int  mode = 0664,
*string  encoding 
)

writes the input data to the given location

Parameters
conna user connection
paththe path of the file to write, relative to conn
datathe file data to write
modethe file's creation mode
encodingthe encoding of the target file
Exceptions
CONNECTION-ERRORthe given connection is not known
FS-USER-CONNECTION-ERRORthe given connection is not a filesystem connection