tko::file -- additional file operations

SYNOPSIS

::tko::file::read file ?fconfigure-args?

::tko::file::write file data ?fconfigure-args?

::tko::file::append file data ?fconfigure-args?

::tko::file::tail mode file ?command? ?delay?

DESCRIPTION

The ""tko::file" functions provide additional file operations.

FUNCTIONS

::tko::file::read file ?fconfigure-args?

Read the given file and return the data. The optional fconfigure-args can be used to configure the opened file channel prior to reading.

::tko::file::write file data ?fconfigure-args?

Write the given data in the given file. The optional fconfigure-args can be used to configure the opened file channel prior to writing.

::tko::file::append file data ?fconfigure-args?

Append the given data to the end of the given file. The optional fconfigure-args can be used to configure the opened file channel prior to writing.

::tko::file::tail mode file ?command? ?delay?

The function is used to tail the content of a given file. If the file disappears or is replaced by a new file with the same name it is handled transparently.

The parameter mode determine the action to perform on the given file.

start The tail operation on the given file begins. The given command will be called with appending "stdout linelist" for new data and "stderr {fd reason}" for state changes. If no command is given then puts is used instead. The additional delay can be used to adjust the time in ms between checking of changes of the file. The default value is 1000.

stop The tail operation on the given file is stopped.

state The given file is used as a pattern and all running tail operations matching this file pattern are returned.

SEE ALSO

tko file [fconfiure][]

KEYWORDS

binding

COPYRIGHT

© 2024- Rene Zaumseil r.zaumseil@freenet.de

BSD style license.