gizlang/fat
FAT32 (Microsoft's FAT specification), written whole into a run of a disk's sectors: the file system of an EFI system partition, which every UEFI firmware reads. Each folder and file lies in one run of clusters. A name that is not an upper-case 8.3 name takes long-name entries beside its short alias.
import * as Fat from "gizlang/fat";Types
File
type File = { path: string; data: bytes; from: string; }A file of the volume: its path (folders by "/"), and its bytes, or those of the host file FROM when FROM is given.
path:stringdata:bytesfrom:string
Functions
sectorsFor
function sectorsFor(bytes: i64): i64The sectors of a FAT32 volume that holds BYTES of files with room to spare: at least 256 MiB, in whole MiB.
Effects: fail.
write
function write(disk: Stream, first: i64, sectors: i64, label: string, files: Vec<File>): void throws stringWrite a FAT32 file system of SECTORS sectors named LABEL, which holds FILES, into DISK from its sector FIRST. It throws when the volume is too small for FAT32 or for the files, or a file cannot be read.
Effects: fail, read, io, alloc.
Constants
SECTOR
const SECTOR = 512The bytes of a sector.