1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-12-27 19:38:06 +11:00
OC-KittenOS/repository/docs/ul-fwrap

54 lines
1.3 KiB
Plaintext
Raw Normal View History

"sys-filewrap" is responsible for
wrapping a filesystem object with a
file-like mechanism.
It simply provides two functions:
ensureMode(mode): Ensures that a
mode is valid, and translates it.
create(dev, file, mode):
Open a file using a given proxy,
filename and mode.
The mode you give to it can be one of
the following:
false: Read "rb"
true: Write "wb"
"append": Append "ab"
May have some readability
properties - just in
case, I've added 'read',
but don't get your hopes
up...
"access": Like read, but can be
re-opened for write.
It returns two things - a table, that
being the file object, and the
'close' function from that object,
for closing the file without using
a potentially modifiable table.
If the table is nil, then the "close"
function is actually a string, that
being the error.
The possible functions are:
[arw] close(): Closes the file.
[arw] seek(whence, pos): Seeks in
the file.
[aw] write(data): Writes to the
file.
[arw] read(data): Reads from the
file. data is the byte count.
However, "*a" is valid here.
Other string-based options are not.
NOTE: Some of these may not actually
work. They're just there as more or
less a "do no harm" approach.
-- This is released into
the public domain.
-- No warranty is provided,
implied or otherwise.