# tko::file(n) -- additional file operations

*   [SYNOPSIS](#SYNOPSIS)
*   [DESCRIPTION](#DESCRIPTION)  
*   [FUNCTIONS](#FUNCTIONS)  
*   [SEE ALSO](#SEE-ALSO)  
*   [KEYWORDS](#KEYWORDS)  
*   [COPYRIGHT](#COPYRIGHT)  

<a name="SYNOPSIS"></a>
## SYNOPSIS

[**::tko::file::read**](#tko::file::read) *file ?fconfigure-args?*

[**::tko::file::write**](#tko::file::write) *file data ?fconfigure-args?*

[**::tko::file::append**](#tko::file::append) *file data ?fconfigure-args?*

[**::tko::file::tail**](#tko::state-namedel) *mode file ?command? ?delay?*

<a name="DESCRIPTION"></a>
## DESCRIPTION

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

<a name="FUNCTIONS"></a>
## FUNCTIONS

<a name="tko::file::read"></a>
**::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.

<a name="tko::file::write"></a>
**::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.

<a name="tko::file::append"></a>
**::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.

<a name="tko::file::tail"></a>
**::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.

<a name="SEE-ALSO"></a>
## SEE ALSO

[tko][] [file][] [fconfiure][]

<a name="KEYWORDS"></a>
## KEYWORDS

binding

<a name="COPYRIGHT"></a>
## COPYRIGHT

&copy; 2024- Rene Zaumseil <r.zaumseil@freenet.de>

BSD style license.

[tko]: <https://chiselapp.com/user/rene/repository/tko/home>
[file]: <https://www.tcl.tk/man/tcl/TclCmd/file.htm>
[fconfigure]: <https://www.tcl.tk/man/tcl/TclCmd/fconfigure.htm>

