Synchronous version of eval.luv.File API

Static methods

@:inheritDoc(eval.luv.File.access)staticaccess(path:NativeString, flags:Array<FileAccessFlag>):Result<NoData>

Checks whether the calling process can access the file at the given path.

@:inheritDoc(eval.luv.File.chmod)staticchmod(path:NativeString, mode:Array<FileMode>):Result<NoData>

Changes permissions of the file at the given path.

@:inheritDoc(eval.luv.File.chown)staticchown(path:NativeString, uid:Int, gid:Int):Result<NoData>

Changes owneship of the file at the given path.

@:inheritDoc(eval.luv.File.close)staticclose(file:File):Result<NoData>

Closes the file.

@:inheritDoc(eval.luv.File.copyFile)staticcopyFile(path:NativeString, toPath:NativeString, ?flags:Array<FileCopyFlag>):Result<NoData>

Copies the file at the given path to the path given by toPath.

@:inheritDoc(eval.luv.File.fchmod)staticfchmod(file:File, mode:Array<FileMode>):Result<NoData>

Changes permissions of the file.

@:inheritDoc(eval.luv.File.fchown)staticfchown(file:File, uid:Int, gid:Int):Result<NoData>

Changes owneship of the file.

@:inheritDoc(eval.luv.File.fdataSync)staticfdataSync(file:File):Result<NoData>

Like eval.luv.File.fsync, but may omit some metadata.

@:inheritDoc(eval.luv.File.fstat)staticfstat(file:File):Result<FileStat>

Retrieves status information for this file.

@:inheritDoc(eval.luv.File.fsync)staticfsync(file:File):Result<NoData>

Flushes file changes to storage.

@:inheritDoc(eval.luv.File.ftruncate)staticftruncate(file:File, length:Int64):Result<NoData>

Truncates the given file to the given length.

@:inheritDoc(eval.luv.File.futime)staticfutime(file:File, atime:Float, mtime:Float):Result<NoData>

Sets timestamps of the file.

@:inheritDoc(eval.luv.File.lchown)staticlchown(path:NativeString, uid:Int, gid:Int):Result<NoData>

Changes owneship of the file at the given path. without dereferencing symlinks.

@:inheritDoc(eval.luv.File.link)staticlink(path:NativeString, link:NativeString):Result<NoData>

Hardlinks a file at the location given by link.

@:inheritDoc(eval.luv.File.lstat)staticlstat(path:NativeString):Result<FileStat>

Like eval.luv.File.stat, but does not dereference symlinks.

@:inheritDoc(eval.luv.File.lutime)staticlutime(path:NativeString, atime:Float, mtime:Float):Result<NoData>

Sets timestamps of the file at the given path without dereferencing symlinks.

@:inheritDoc(eval.luv.File.mkdir)staticmkdir(path:NativeString, ?mode:Array<FileMode>):Result<NoData>

Creates a directory.

@:inheritDoc(eval.luv.File.mkdtemp)staticmkdtemp(pattern:NativeString):Result<NativeString>

Creates a temporary directory with name based on the given pattern.

@:inheritDoc(eval.luv.File.mkstemp)staticmkstemp(pattern:NativeString):Result<{name:NativeString, file:File}>

Creates a temporary file with name based on the given pattern.

@:inheritDoc(eval.luv.File.open)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.

@:inheritDoc(eval.luv.File.read)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.

@:inheritDoc(eval.luv.File.readLink)staticreadLink(path:NativeString):Result<NativeString>

Reads the target path of a symlink.

@:inheritDoc(eval.luv.File.realPath)staticrealPath(path:NativeString):Result<NativeString>

Resolves a real absolute path to the given file.

@:inheritDoc(eval.luv.File.rename)staticrename(path:NativeString, toPath:NativeString):Result<NoData>

Moves the file at the given path to the path given by toPath

@:inheritDoc(eval.luv.File.rmdir)staticrmdir(path:NativeString):Result<NoData>

Deletes a directory.

@:inheritDoc(eval.luv.File.sendFile)staticsendFile(file:File, toFile:File, offset:Int64, length:UInt64):Result<UInt64>

Transfers data between file descriptors.

@:inheritDoc(eval.luv.File.stat)staticstat(path:NativeString):Result<FileStat>

Retrieves status information for the file at the given path.

@:inheritDoc(eval.luv.File.statFs)staticstatFs(path:NativeString):Result<FileStatFs>

Retrieves status information for the filesystem containing the given path.

@:inheritDoc(eval.luv.File.symlink)staticsymlink(path:NativeString, link:NativeString, ?flags:Array<FileSymlinkFlag>):Result<NoData>

Symlinks a file at the location given by link.

@:inheritDoc(eval.luv.File.unlink)staticunlink(path:NativeString):Result<NoData>

Deletes the file at the given path.

@:inheritDoc(eval.luv.File.utime)staticutime(path:NativeString, atime:Float, mtime:Float):Result<NoData>

Sets timestamps of the file at the given path.

@:inheritDoc(eval.luv.File.write)staticwrite(file:File, fileOffset:Int64, buffers:Array<Buffer>):Result<UInt64>

Writes to the file.