fd: synchronous and asynchronous file descriptors
fd implements an API identical to lua's
file object but with support for
async operations following the
lib/lap protocol.
filedescriptor: direct control of filedescriptors.
async operations support the LAP (see lib/lap) protocol.
Can override default `io` module for global async mode.
Functions
- fn fstmode(fileno) -> st_mode?, error
Get the st_mode of the fileno.
- fn fchmod(fileno, st_mode) -> ok?, error
Change the st_mode of the fileno.
- fn isTrunc(mode) -> bool
Given a string mode, return whether the file will be truncated.
- fn isCreate(mode)
Given a string mode, return whether the file will be created
if it doesn't exist.
- fn newFD
Use to explicitly create a sync file-descriptor.
Operations will block the current program until complete.
- fn newFDT
Use to explicitly create a async file-descriptor.
Operations will yield if not yet complete.
- fn openWith(openFn, path, mode)
- fn openFD(S.openFD, ...)
- fn openFDT(S.openFDT, ...)
- fn open(...)
- fn close()
- fn tmpfileFn(sysFn)
- fn tmpfile() -> M.tmpfileFn(S.tmpFD)
- fn read(...)
- fn lines(path, mode)
- fn write(...)
- fn openFileno(fileno)
- fn input()
- fn output()
- fn flush()
- fn type(fd)
- fn fileno(fd)
- fn ftype(f)
- fn isatty(fd)
- fn ioStd()
Switch the global io module to use builtin functions.
- fn ioSync()
Switch the global io module to use sync functions from
this module.
- fn ioAsync()
Switch the global io module to use async functions from
this module.