commonio
nimony/lib/std/commonio.nim
The vocabulary shared by the two file APIs, std/syncio and std/asyncio. Both export this module, so a program importing both sees one FileMode, one fmRead and so on, rather than two that are ambiguous.
Also here: what a FileMode and a permission set mean to the operating system's open call, so the two APIs cannot disagree about it.
type FileMode = enum fmRead = (0, "fmRead") fmWrite = (1, "fmWrite") fmReadWrite = (2, "fmReadWrite") fmReadWriteExisting = (3, "fmReadWriteExisting") fmAppend = (4, "fmAppend")
func dollar`.FileMode(e: FileMode): stringtype FileSeekPos = enum fspSet = (0, "fspSet") fspCur = (1, "fspCur") fspEnd = (2, "fspEnd")
func dollar`.FileSeekPos(e: FileSeekPos): stringtype FilePermission = enum fpUserExec = (0, "fpUserExec") fpUserWrite = (1, "fpUserWrite") fpUserRead = (2, "fpUserRead") fpGroupExec = (3, "fpGroupExec") fpGroupWrite = (4, "fpGroupWrite") fpGroupRead = (5, "fpGroupRead") fpOthersExec = (6, "fpOthersExec") fpOthersWrite = (7, "fpOthersWrite") fpOthersRead = (8, "fpOthersRead")
func dollar`.FilePermission(e: FilePermission): stringconst DefaultPermissions: set[FilePermission]0o666: readable and writable by everyone, before the umask.proc permissionBits(p: set[FilePermission]): int32pas the POSIX mode bitsopen(2)takes.proc posixOpenFlags(mode: FileMode): int32The
open(2)flags formode.