Synchronous version of eval.luv.File
API
Static methods
staticaccess(path:NativeString, flags:Array<FileAccessFlag>):Result<NoData>
Checks whether the calling process can access the file at the given path.
staticchmod(path:NativeString, mode:Array<FileMode>):Result<NoData>
Changes permissions of the file at the given path.
staticchown(path:NativeString, uid:Int, gid:Int):Result<NoData>
Changes owneship of the file at the given path.
staticcopyFile(path:NativeString, toPath:NativeString, ?flags:Array<FileCopyFlag>):Result<NoData>
Copies the file at the given path to the path given by toPath
.
staticftruncate(file:File, length:Int64):Result<NoData>
Truncates the given file to the given length.
staticlchown(path:NativeString, uid:Int, gid:Int):Result<NoData>
Changes owneship of the file at the given path. without dereferencing symlinks.
staticlink(path:NativeString, link:NativeString):Result<NoData>
Hardlinks a file at the location given by link
.
staticlstat(path:NativeString):Result<FileStat>
Like eval.luv.File.stat
, but does not dereference symlinks.
staticlutime(path:NativeString, atime:Float, mtime:Float):Result<NoData>
Sets timestamps of the file at the given path without dereferencing symlinks.
staticmkdtemp(pattern:NativeString):Result<NativeString>
Creates a temporary directory with name based on the given pattern.
staticmkstemp(pattern:NativeString):Result<{name:NativeString, file:File}>
Creates a temporary file with name based on the given pattern.
staticopen(path:NativeString, flags:Array<FileOpenFlag>, ?mode:Array<FileMode>):Result<File>
Opens the file at the given path.
The default value of the mode
argument is equal to octal 0o644
.
staticread(file:File, fileOffset:Int64, buffers:Array<Buffer>):Result<UInt64>
Reads from the file.
The incoming data is written consecutively to into the given buffers. The number of bytes that the operation tries to read is the total length of the buffers.
End of file is indicated by Result.Ok(0)
. Note that this is different
from eval.luv.Stream.readStart
.
staticrealPath(path:NativeString):Result<NativeString>
Resolves a real absolute path to the given file.
staticrename(path:NativeString, toPath:NativeString):Result<NoData>
Moves the file at the given path to the path given by toPath
staticsendFile(file:File, toFile:File, offset:Int64, length:UInt64):Result<UInt64>
Transfers data between file descriptors.
staticstat(path:NativeString):Result<FileStat>
Retrieves status information for the file at the given path.
staticstatFs(path:NativeString):Result<FileStatFs>
Retrieves status information for the filesystem containing the given path.
staticsymlink(path:NativeString, link:NativeString, ?flags:Array<FileSymlinkFlag>):Result<NoData>
Symlinks a file at the location given by link
.