For the latest stable version, please use Emilua API 0.10! |
file.stream
Functions
new() → file.stream
new() (1)
new(fd: file_descriptor) (2)
1 | Default constructor. |
2 | Converts a file descriptor into a file.stream object. |
open(self, path: filesystem.path, flags: integer)
Open the file using the specified path.
flags
is an or-combination of values from
file.open_flag(3em).
close(self)
Close the file.
Forward the call to the function with same name in Boost.Asio:
Any asynchronous read or write operations will be cancelled immediately, and will complete with the
boost::asio::error::operation_aborted
error.
cancel(self)
Cancel all asynchronous operations associated with the file.
Forward the call to the function with same name in Boost.Asio:
This function causes all outstanding asynchronous read and write operations to finish immediately, and the handlers for cancelled operations will be passed the
boost::asio::error::operation_aborted
error.
release(self) → file_descriptor
Release ownership of the native descriptor implementation.
Forward the call to the function with same name in Boost.Asio:
This function causes all outstanding asynchronous read and write operations to finish immediately, and the handlers for cancelled operations will be passed the
boost::asio::error::operation_aborted
error. Ownership of the native file is then transferred to the caller.
resize(self, n: integer)
Alter the size of the file.
This function resizes the file to the specified size, in bytes. If the current file size exceeds n then any extra data is discarded. If the current size is less than n then the file is extended and filled with zeroes
seek(self, offset: integer, whence: string) → integer
Sets and gets the file position, measured from the beginning of the file, to the
position given by offset
plus a base specified by the string whence
, as
follows:
"set"
-
Seek to an absolute position.
"cur"
-
Seek to an offset relative to the current file position.
"end"
-
Seek to an offset relative to the end of the file.
Returns the final file position, measured in bytes from the beginning of the file.
Lua conventions on index starting at 1 are ignored. Indexes here
are OS-mandated and start at 0 .
|