FAT12/16/32 on-disk volume codec for MoonBit
moon add chenliyi-cly/moonfatmoon run examples/inspect
moon run examples/write_payload
moon run examples/verify_imagelet vol = format_volume({
kind: Fat12,
bytes_per_sector: 512,
total_sectors: 160,
volume_label: "MOONFAT",
volume_id: 0x4D4F4F4E,
}).unwrap()
vol.mkdir("/EFI").unwrap()
vol.write_file("/README.TXT", payload).unwrap()
let names = vol.list("/").unwrap()
let issues = vol.verify()moon fmt --check
moon check --target wasm-gc --deny-warn
moon test --target wasm-gc
moon run examples/inspect
moon run examples/write_payload
moon run examples/verify_imagepub(all) enum FatError {
Truncated(String, Int, Int)
InvalidBoot(String)
Unsupported(String)
BadCluster(Int)
ChainLoop(Int)
NotFound(String)
AlreadyExists(String)
NotDirectory(String)
IsDirectory(String)
DirectoryNotEmpty(String)
NoSpace
InvalidName(String)
Corrupt(String)
InvalidPath(String)
SlotExhausted
} derive(Eq, Debug)pub(all) struct Layout {
kind : FatKind
bytes_per_sector : Int
sectors_per_cluster : Int
reserved_sectors : Int
fat_count : Int
fat_sectors : Int
root_entries : Int
root_dir_sectors : Int
first_fat_sector : Int
first_root_sector : Int
first_data_sector : Int
cluster_count : Int
root_cluster : Int
total_sectors : Int
media : Byte
volume_id : Int
label : String
fsinfo_sector : Int
backup_boot_sector : Int
} derive(Debug)pub(all) struct RawEntry {
offset : Int
name : Bytes
attr : Int
nt_res : Int
create_tenth : Int
create_time : Int
create_date : Int
access_date : Int
cluster : Int
write_time : Int
write_date : Int
size : Int
} derive(Debug)Install
Download zipFAT12/16/32 on-disk volume codec for MoonBit