njs/fs

Types

pub type Dirent
pub type FileHandle
pub type FileOption {
  ReadFileOption(encoding: String, flag: String)
  WriteFileOption(mode: Int, flag: String)
}

Constructors

  • ReadFileOption(encoding: String, flag: String)
  • WriteFileOption(mode: Int, flag: String)
pub type FileReadResult {
  FileReadResult(bytes_read: Int, buffer: buffer.Buffer)
}

Constructors

pub type Stats

Values

pub fn access(
  path: String,
  mode: Int,
) -> promise.Promise(Result(Bool, Nil))
pub fn access_sync(path: String, mode: Int) -> Result(Bool, Nil)
pub fn append_file(
  filename f: String,
  data d: a,
  option o: FileOption,
) -> promise.Promise(Nil)
pub fn append_file_sync(
  filename f: String,
  data d: a,
  option o: FileOption,
) -> Nil
pub const base64: String
pub const base64url: String
pub const buf: String
pub fn close(fd: Int) -> promise.Promise(Nil)
pub fn close_sync(fd: Int) -> Nil
pub fn constants_f_ok() -> Int
pub fn constants_r_ok() -> Int
pub fn constants_w_ok() -> Int
pub fn constants_x_ok() -> Int
pub fn dirent_is_block_device(dirent: Dirent) -> Bool
pub fn dirent_is_character_device(dirent: Dirent) -> Bool
pub fn dirent_is_directory(dirent: Dirent) -> Bool
pub fn dirent_is_fifo(dirent: Dirent) -> Bool
pub fn dirent_is_file(dirent: Dirent) -> Bool
pub fn dirent_is_socket(dirent: Dirent) -> Bool
pub fn dirent_is_symbolic_link(dirent: Dirent) -> Bool
pub fn dirent_name(dirent: Dirent) -> String
pub fn exists(path: String) -> promise.Promise(Bool)
pub fn exists_sync(path: String) -> Bool
pub fn file_handle_close(
  handle: FileHandle,
) -> promise.Promise(Nil)
pub fn file_handle_fd(handle: FileHandle) -> Int
pub fn file_handle_read(
  handle: FileHandle,
  length: Int,
  position: Int,
) -> promise.Promise(FileReadResult)
pub fn file_handle_stat(
  handle: FileHandle,
) -> promise.Promise(Stats)
pub fn file_handle_write(
  handle: FileHandle,
  buffer: buffer.Buffer,
  offset: Int,
  length: Int,
  position: Int,
) -> promise.Promise(FileReadResult)
pub const flag_a: String
pub const flag_aplus: String
pub const flag_as: String
pub const flag_asplus: String
pub const flag_ax: String
pub const flag_axplus: String
pub const flag_r: String
pub const flag_rplus: String
pub const flag_rs: String
pub const flag_rsplus: String
pub const flag_w: String
pub const flag_wplus: String
pub const flag_wx: String
pub const flag_wxplus: String
pub fn fstat(fd: Int) -> promise.Promise(Stats)
pub fn fstat_sync(fd: Int) -> Stats
pub const hex: String
pub fn lstat(path: String) -> promise.Promise(Result(Stats, Nil))
pub fn lstat_sync(path: String) -> Result(Stats, Nil)
pub fn mkdir(path: String, mode: Int) -> promise.Promise(Nil)
pub fn mkdir_sync(path: String, mode: Int) -> Nil
pub fn open(
  path: String,
  flags: String,
  mode: Int,
) -> promise.Promise(FileHandle)
pub fn open_sync(path: String, flags: String, mode: Int) -> Int
pub fn read(
  fd d: Int,
  length l: Int,
  position p: Int,
) -> promise.Promise(FileReadResult)
pub fn read_dir(
  path p: String,
  encoding e: String,
) -> promise.Promise(array.Array(Dirent))
pub fn read_dir_sync(
  path p: String,
  encoding e: String,
) -> array.Array(Dirent)
pub fn read_file(
  filename f: String,
  option o: FileOption,
) -> promise.Promise(String)
pub fn read_file_sync(
  filename f: String,
  option o: FileOption,
) -> String
pub fn read_link(
  path: String,
  encoding: String,
) -> promise.Promise(a)
pub fn read_link_sync(path: String, encoding: String) -> a
pub fn read_sync(
  fd d: Int,
  length l: Int,
  position p: Int,
) -> FileReadResult
pub fn real_path(
  path: String,
  encoding: String,
) -> promise.Promise(String)
pub fn real_path_sync(path: String, encoding: String) -> String
pub fn rename(
  old_path: String,
  new_path: String,
) -> promise.Promise(Nil)
pub fn rename_sync(old_path: String, new_path: String) -> Nil
pub fn rmdir(path: String) -> promise.Promise(Nil)
pub fn rmdir_sync(path: String) -> Nil
pub fn stat(path: String) -> promise.Promise(Result(Stats, Nil))
pub fn stat_sync(path: String) -> Result(Stats, Nil)
pub fn stats_atime(stats: Stats) -> String
pub fn stats_atime_ms(stats: Stats) -> Int
pub fn stats_birthtime(stats: Stats) -> String
pub fn stats_birthtime_ms(stats: Stats) -> Int
pub fn stats_blksize(stats: Stats) -> Int
pub fn stats_blocks(stats: Stats) -> Int
pub fn stats_ctime(stats: Stats) -> String
pub fn stats_ctime_ms(stats: Stats) -> Int
pub fn stats_dev(stats: Stats) -> Int
pub fn stats_gid(stats: Stats) -> Int
pub fn stats_ino(stats: Stats) -> Int
pub fn stats_is_block_device(stats: Stats) -> Bool
pub fn stats_is_directory(stats: Stats) -> Bool
pub fn stats_is_fifo(stats: Stats) -> Bool
pub fn stats_is_file(stats: Stats) -> Bool
pub fn stats_is_socket(stats: Stats) -> Bool
pub fn stats_is_symbolic_link(stats: Stats) -> Bool
pub fn stats_mode(stats: Stats) -> Int
pub fn stats_mtime(stats: Stats) -> String
pub fn stats_mtime_ms(stats: Stats) -> Int
pub fn stats_nlink(stats: Stats) -> Int
pub fn stats_rdev(stats: Stats) -> Int
pub fn stats_size(stats: Stats) -> Int
pub fn stats_uid(stats: Stats) -> Int
pub fn symlink(
  target: String,
  path: String,
) -> promise.Promise(Nil)
pub fn symlink_sync(target: String, path: String) -> Nil
pub fn unlink(path: String) -> promise.Promise(Nil)
pub fn unlink_sync(path: String) -> Nil
pub const utf8: String
pub fn write(
  fd: Int,
  buffer: buffer.Buffer,
  offset: Int,
  length: Int,
  position: Int,
) -> promise.Promise(Int)
pub fn write_file(
  filename f: String,
  data d: a,
  option o: FileOption,
) -> promise.Promise(Nil)
pub fn write_file_sync(
  filename f: String,
  data d: a,
  option o: FileOption,
) -> Nil
pub fn write_sync(
  fd: Int,
  buffer: buffer.Buffer,
  offset: Int,
  length: Int,
  position: Int,
) -> Int
Search Document