amber/fs_file
Types
Values
pub fn close(file: FsFile) -> Result(Nil, error.Error)
pub fn is_terminal(file: FsFile) -> Bool
pub fn lock_sync(
file: FsFile,
exclusive exclusive: Bool,
) -> Result(FsFile, error.Error)
Acquires an advisory file lock. Mutates the file in-place and returns it for chaining.
pub fn read_sync(
file: FsFile,
into p: uint8_array.Uint8Array,
) -> Result(bytes_read.BytesRead, error.Error)
pub fn readable(
of file: FsFile,
) -> readable_stream.ReadableStream(uint8_array.Uint8Array)
pub fn seek_sync(
file: FsFile,
to offset: Int,
from whence: seek_mode.SeekMode,
) -> Result(Int, error.Error)
pub fn set_raw(
file: FsFile,
to mode: Bool,
) -> Result(FsFile, error.Error)
Set the file to raw mode. Mutates the file in-place and returns it for chaining.
pub fn set_raw_with(
file: FsFile,
to mode: Bool,
with options: List(set_raw.SetRawOption),
) -> Result(FsFile, error.Error)
Set the file to raw mode with options. Mutates the file in-place and returns it for chaining.
pub fn stat_sync(
of file: FsFile,
) -> Result(file_info.FileInfo, error.Error)
pub fn sync_data_sync(
file: FsFile,
) -> Result(FsFile, error.Error)
Flushes pending data operations to disk (not metadata). Mutates the file in-place and returns it for chaining.
pub fn sync_sync(file: FsFile) -> Result(FsFile, error.Error)
Flushes pending data and metadata operations to disk. Mutates the file in-place and returns it for chaining.
pub fn truncate_sync(file: FsFile) -> Result(FsFile, error.Error)
Truncates the file to length zero. Mutates the file in-place and returns it for chaining.
pub fn truncate_to_length_sync(
file: FsFile,
to len: Int,
) -> Result(FsFile, error.Error)
Truncates the file to the given length. Mutates the file in-place and returns it for chaining.
pub fn unlock_sync(file: FsFile) -> Result(FsFile, error.Error)
Releases an advisory file lock. Mutates the file in-place and returns it for chaining.
pub fn using(
file_result: Result(FsFile, error.Error),
apply fun: fn(FsFile) -> Result(a, error.Error),
) -> Result(a, error.Error)
pub fn utime_sync(
file: FsFile,
atime atime: Int,
mtime mtime: Int,
) -> Result(FsFile, error.Error)
Changes the access and modification times of the file. Mutates the file in-place and returns it for chaining.
pub fn writable(
of file: FsFile,
) -> writable_stream.WritableStream(uint8_array.Uint8Array)
pub fn write_sync(
file: FsFile,
from p: uint8_array.Uint8Array,
) -> Result(Int, error.Error)