Skip to content

stdlib/fsView source ↗

fs

40 items · generated by scribe fromstdlib/fs.fd· synced 2026-11-15

stdlib/fs40 items

Contents

fs_exists

Check if a file exists.

pub fn fs_exists(path: str) -> bool {

Parameters:

  • path: str

Returns: bool

Defined at line 18


fs_file_size

Get file size in bytes. Returns -1 if file doesn’t exist.

pub fn fs_file_size(path: str) -> i64 {

Parameters:

  • path: str

Returns: i64

Defined at line 23


fs_read_text

Read a file as text. Returns "" if file doesn’t exist.

pub fn fs_read_text(path: str) -> str {

Parameters:

  • path: str

Returns: str

Defined at line 30


fs_read_bytes

Read a file as a Vec of bytes. Returns empty Vec if file doesn’t exist.

pub fn fs_read_bytes(path: str) -> Vec<i64> {

Parameters:

  • path: str

Returns: Vec<i64>

Defined at line 42


fs_read_lines

Read a file as lines. Returns empty Vec if file doesn’t exist.

pub fn fs_read_lines(path: str) -> Vec<str> {

Parameters:

  • path: str

Returns: Vec<str>

Defined at line 47


fs_write_text

Write text to a file. Overwrites if exists. Returns true on success.

pub fn fs_write_text(path: str, content: str) -> bool {

Parameters:

  • path: str
  • content: str

Returns: bool

Defined at line 58


fs_write_bytes

Write bytes to a file. Overwrites if exists. Returns true on success.

pub fn fs_write_bytes(path: str, bytes: Vec<i64>) -> bool {

Parameters:

  • path: str
  • bytes: Vec<i64>

Returns: bool

Defined at line 63


fs_append_text

Append text to a file. Creates if doesn’t exist. Returns true on success.

pub fn fs_append_text(path: str, content: str) -> bool {

Parameters:

  • path: str
  • content: str

Returns: bool

Defined at line 68


fs_delete

Delete a file. Returns true on success.

pub fn fs_delete(path: str) -> bool {

Parameters:

  • path: str

Returns: bool

Defined at line 75


fs_rename

Rename/move a file. Returns true on success.

pub fn fs_rename(old_path: str, new_path: str) -> bool {

Parameters:

  • old_path: str
  • new_path: str

Returns: bool

Defined at line 80


fs_list_dir

List entries in a directory (names only, no ”.” or ”..”). Returns empty Vec if directory doesn’t exist or can’t be opened.

pub fn fs_list_dir(path: str) -> Vec<str> {

Parameters:

  • path: str

Returns: Vec<str>

Defined at line 88


fs_is_dir

Check if a path is a directory.

pub fn fs_is_dir(path: str) -> bool {

Parameters:

  • path: str

Returns: bool

Defined at line 97


fs_is_file

Check if a path is a file (not a directory).

pub fn fs_is_file(path: str) -> bool {

Parameters:

  • path: str

Returns: bool

Defined at line 102


fs_mkdir

Create a single directory. Returns true on success (false if it already exists or the parent is missing — use fs_mkdir_all for the recursive form).

pub fn fs_mkdir(path: str) -> bool {

Parameters:

  • path: str

Returns: bool

Defined at line 111


fs_mkdir_all

Create a directory and all missing parents (“mkdir -p”). Returns true if the directory exists afterwards.

pub fn fs_mkdir_all(path: str) -> bool {

Parameters:

  • path: str

Returns: bool

Defined at line 117


fs_rmdir

Remove an empty directory. Returns true on success.

pub fn fs_rmdir(path: str) -> bool {

Parameters:

  • path: str

Returns: bool

Defined at line 151


fs_rmdir_all

Remove a directory and everything inside it (“rm -rf”). Returns true when the path no longer exists afterwards.

pub fn fs_rmdir_all(path: str) -> bool {

Parameters:

  • path: str

Returns: bool

Defined at line 157


fs_walk

Recursively list every file and directory under dir (depth-first, full paths relative to dir as given). Empty Vec when dir is not a readable directory.

pub fn fs_walk(dir: str) -> Vec<str> {

Parameters:

  • dir: str

Returns: Vec<str>

Defined at line 202


fs_walk_files

Like fs_walk but reports only files, not directories.

pub fn fs_walk_files(dir: str) -> Vec<str> {

Parameters:

  • dir: str

Returns: Vec<str>

Defined at line 212


fs_glob_match

Does name match a single-segment glob pattern (*, ?)? This is the same wildcard matcher as regex_match.

pub fn fs_glob_match(name: str, pattern: str) -> bool {

Parameters:

  • name: str
  • pattern: str

Returns: bool

Defined at line 232


fs_glob

Match pattern against the directory tree under dir. Returns matching paths as dir-relative full paths. fs_glob(“src”, “.fd”) — direct children ending in .fd fs_glob(“src”, ”**/.fd”) — .fd files at any depth fs_glob(“src”, “a/?/b.txt”) — single-char middle component

pub fn fs_glob(dir: str, pattern: str) -> Vec<str> {

Parameters:

  • dir: str
  • pattern: str

Returns: Vec<str>

Defined at line 278


fs_temp_path

Return a fresh temp-file path in dir (created on first write). The path does not exist yet — nothing is created.

pub fn fs_temp_path(dir: str, prefix: str) -> str {

Parameters:

  • dir: str
  • prefix: str

Returns: str

Defined at line 297


fs_temp_file

Create an empty temp file in dir and return its path, or "" on failure. prefix becomes the first characters of the file name.

pub fn fs_temp_file(dir: str, prefix: str) -> str {

Parameters:

  • dir: str
  • prefix: str

Returns: str

Defined at line 303


fs_temp_dir

Create a temp directory in dir and return its path, or "" on failure.

pub fn fs_temp_dir(dir: str, prefix: str) -> str {

Parameters:

  • dir: str
  • prefix: str

Returns: str

Defined at line 319


fs_join

Join two path components (handles ”/”, also treats "" as separator on the right-hand side for Windows callers).

pub fn fs_join(a: str, b: str) -> str {

Parameters:

  • a: str
  • b: str

Returns: str

Defined at line 343


fs_basename

The last path component (after ’/’ or ”); "" for a trailing sep.

pub fn fs_basename(path: str) -> str {

Parameters:

  • path: str

Returns: str

Defined at line 364


fs_dirname

Everything before the last ’/’ or ”; "" when there is none.

pub fn fs_dirname(path: str) -> str {

Parameters:

  • path: str

Returns: str

Defined at line 378


fs_ext

The extension including the dot (“a.tar.gz” -> “.gz”); "" when none.

pub fn fs_ext(path: str) -> str {

Parameters:

  • path: str

Returns: str

Defined at line 391


fs_stem

Path without its final extension.

pub fn fs_stem(path: str) -> str {

Parameters:

  • path: str

Returns: str

Defined at line 408


fs_path_in

Get the full path of a file in a directory.

pub fn fs_path_in(dir: str, filename: str) -> str {

Parameters:

  • dir: str
  • filename: str

Returns: str

Defined at line 414


file_read

Alias for file_read: read file contents as a string.

pub fn file_read(path: str) -> str {

Parameters:

  • path: str

Returns: str

Defined at line 422


file_write

Alias for file_write: write string to a file. Returns 0 on success, -1 on error.

pub fn file_write(path: str, content: str) -> i64 {

Parameters:

  • path: str
  • content: str

Returns: i64

Defined at line 427


file_append

Alias for file_append: append string to a file. Returns 0 on success, -1 on error.

pub fn file_append(path: str, content: str) -> i64 {

Parameters:

  • path: str
  • content: str

Returns: i64

Defined at line 435


file_exists

Alias for file_exists: check if a file exists.

pub fn file_exists(path: str) -> bool {

Parameters:

  • path: str

Returns: bool

Defined at line 443


file_delete

Alias for file_delete: delete a file. Returns 0 on success, -1 on error.

pub fn file_delete(path: str) -> i64 {

Parameters:

  • path: str

Returns: i64

Defined at line 448


file_size

Alias for file_size: get file size in bytes, or -1 if it doesn’t exist.

pub fn file_size(path: str) -> i64 {

Parameters:

  • path: str

Returns: i64

Defined at line 456


Generated by scribe, the Fides documentation generator