package eio
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=346104884077f140b3574e1daccc02212960c6efeb793c803e3e6b8bafea0fab
sha512=18abde418c56b1ceed3e8f075cb94e5c951b5cfea967ec4cb5f8e1e4d635b801b3c9e6ec61f89483490dbec143c33b9b76d947bff1183d44e6e0e01d93821dfb
doc/eio/Eio/File/index.html
Module Eio.FileSource
Operations on open files.
Files implement the Flow APIs, which can be used for reading and writing data. This module provides additonal file-specific operations, such as seeking within a file.
To get an open file, use the functions in the Path module.
Types
Metadata
size t returns the size of t.
Reading and writing
pread t ~file_offset bufs performs a single read of t at file_offset into bufs.
It returns the number of bytes read, which may be less than the space in bufs, even if more bytes are available. Use pread_exact instead if you require the buffer to be filled.
To read at the current offset, use Flow.single_read instead.
pread_exact t ~file_offset bufs reads from t into bufs until bufs is full.
pwrite_single t ~file_offset bufs performs a single write operation, writing data from bufs to location file_offset in t.
It returns the number of bytes written, which may be less than the length of bufs. In most cases, you will want to use pwrite_all instead.
pwrite_all t ~file_offset bufs writes all the data in bufs to location file_offset in t.
Set and/or get the current file position.
Like Unix.lseek.
Set the length of a file.
Like Unix.ftruncate.