bit_io

Abstract FileSystem traits and in-memory test implementation

git
fs
io
moon add mizchi/bit_io@0.46.4
Download zip
Author
Version
0.46.4
License
Apache-2.0
Last updated
4 days ago
Downloads
572

Dependencies

README

#
AsyncFileSystem

Asynchronous counterpart to FileSystem.

#
AsyncHttpClient

Asynchronous counterpart to HttpClient.

#
AsyncRepoFileSystem

Asynchronous counterpart to RepoFileSystem.

#
FileSystem

#
HttpClient

#
HttpResponse

#
MockHttpClient

#
RepoFileSystem

#
EnvProvider

pub struct EnvProvider {
get : (String) -> String?
current_dir : () -> String?
}

#
EnvProvider::new

fn EnvProvider::new(get : (String) -> String?, current_dir : () -> String?) -> EnvProvider

#
EnvProvider::none

fn EnvProvider::none() -> EnvProvider

#
TestFs

pub struct TestFs {
files : Map[String, Bytes]
dirs : Map[String, Bool]
}

#
TestFs::exists

fn TestFs::exists(self : TestFs, path : String) -> Bool

#
TestFs::is_dir

fn TestFs::is_dir(self : TestFs, path : String) -> Bool

#
TestFs::is_file

fn TestFs::is_file(self : TestFs, path : String) -> Bool

#
TestFs::mkdir_p

fn TestFs::mkdir_p(self : TestFs, path : String) -> Unit

#
TestFs::new

fn TestFs::new() -> TestFs

#
TestFs::read_file

fn TestFs::read_file(self : TestFs, path : String) -> Bytes raise
GitError

#
TestFs::read_string

fn TestFs::read_string(self : TestFs, path : String) -> String raise
GitError

#
TestFs::readdir

fn TestFs::readdir(self : TestFs, path : String) -> Array[String] raise
GitError

#
TestFs::remove_dir

fn TestFs::remove_dir(self : TestFs, path : String) -> Unit raise
GitError

#
TestFs::remove_file

fn TestFs::remove_file(self : TestFs, path : String) -> Unit raise
GitError

#
TestFs::write_file

fn TestFs::write_file(self : TestFs, path : String, content : Bytes) -> Unit

#
TestFs::write_string

fn TestFs::write_string(self : TestFs, path : String, content : String) -> Unit

#
WorktreeEntry

pub struct WorktreeEntry {
kind : WorktreeKind
mode : Int
size : Int?
mtime_sec : Int?
mtime_nsec : Int?
}

#
WorktreeEntryMeta

pub struct WorktreeEntryMeta {
kind : WorktreeKindMeta
mode : Int
size : Int?
mtime_sec : Int?
mtime_nsec : Int?
dev : Int?
ino : Int?
uid : Int?
gid : Int?
}

#
WorktreeEntryMeta::mtime

fn WorktreeEntryMeta::mtime(self : WorktreeEntryMeta) -> (Int, Int)

#
WorktreeEntryMeta::new

fn WorktreeEntryMeta::new(kind : WorktreeKindMeta, mode : Int, size : Int?, mtime_sec : Int?, mtime_nsec : Int?, dev? : Int?, ino? : Int?, uid? : Int?, gid? : Int?) -> WorktreeEntryMeta

#
WorktreeKind

pub enum WorktreeKind {
Regular
Symlink(target~ : String)
}

#
WorktreeKindMeta

pub enum WorktreeKindMeta {
Regular
Symlink
}

#
WorktreeKindMeta::regular

#
WorktreeProbeProvider

pub struct WorktreeProbeProvider {
entry_meta : async (&
RepoFileSystem
, String) -> WorktreeEntryMeta? noraise
entry_meta_sync : (&
RepoFileSystem
, String) -> WorktreeEntryMeta?
lstat : (String) -> WorktreeEntryMeta?
symlink_target : (String) -> String?
readdir_typed : (String) -> Array[(String, Int)]?
}

#
WorktreeProbeProvider::new

fn WorktreeProbeProvider::new(entry_meta : async (&
RepoFileSystem
, String) -> WorktreeEntryMeta? noraise, symlink_target : (String) -> String?, entry_meta_sync? : (&
RepoFileSystem
, String) -> WorktreeEntryMeta?, lstat? : (String) -> WorktreeEntryMeta?, readdir_typed? : (String) -> Array[(String, Int)]?) -> WorktreeProbeProvider

#
WorktreeProbeProvider::none

#
env_current_dir

fn env_current_dir() -> String?

#
env_get

fn env_get(name : String) -> String?

#
lstat_entry_meta

fn lstat_entry_meta(abs_path : String) -> WorktreeEntryMeta?

Stat a file without requiring RepoFileSystem. Uses the native lstat provider when available, otherwise returns None.
fn read_symlink_target_path(path : String) -> String?

#
readdir_typed

fn readdir_typed(path : String) -> Array[(String, Int)]?

Read directory entries with file type info. Returns (name, d_type) pairs. d_type: 4=DT_DIR, 8=DT_REG, 10=DT_LNK, 0=DT_UNKNOWN. Returns None if native readdir is not available (fallback to fs.readdir + is_dir).

#
set_env_provider

fn set_env_provider(provider : EnvProvider) -> Unit

#
set_worktree_probe

fn set_worktree_probe(provider : WorktreeProbeProvider) -> Unit

#
worktree_entry

async fn worktree_entry(fs : &
RepoFileSystem
, abs_path : String) -> WorktreeEntry? noraise

#
worktree_entry_meta

async fn worktree_entry_meta(fs : &
RepoFileSystem
, abs_path : String) -> WorktreeEntryMeta? noraise

#
worktree_entry_meta_sync

fn worktree_entry_meta_sync(fs : &
RepoFileSystem
, abs_path : String) -> WorktreeEntryMeta?

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io