1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-11-09 20:18:07 +11:00
OC-KittenOS/repository/docs/ul-fwrap
20kdc a5372eafe1 All the current progress, including KTC1 draft in case there's no other standard
KTC1 is only a draft for now, and if there's something equivalent to replace it,
 I will not hesitate to do so.
2018-04-12 00:04:16 +01:00

50 lines
1.2 KiB
Plaintext

"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
propertiues - just in
case, I've added 'read',
but don't get your hopes
up...
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.
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.