@anymux/file-system
v0.1.0
Published
Core file system interface and in-memory implementation for AnyMux
Maintainers
Readme
@anymux/file-system
Core file system interface and in-memory implementation for AnyMux.
Installation
pnpm add @anymux/file-systemUsage
import { MemoryFileSystem } from "@anymux/file-system/mem-fs";
const fs = new MemoryFileSystem();
await fs.writeFile("/hello.txt", "Hello, world!");
const content = await fs.readFile("/hello.txt", "utf-8");API Overview
IFileSystem
The core interface matching Node.js fs.promises:
readFile(path, options?)— Read file contentswriteFile(path, data, options?)— Write data to a filemkdir(path, options?)— Create directoriesreaddir(path, options?)— List directory contentsstat(path)/lstat(path)— Get file metadatarename(oldPath, newPath)— Rename/move filesunlink(path)— Delete filesrmdir(path)/rm(path, options?)— Remove directoriescopyFile(src, dest)— Copy filessymlink(target, path)— Create symbolic linkscreateReadStream(path)/createWriteStream(path)— Streaming I/Owatch(path, options?)— Watch for changes
MemoryFileSystem
A complete in-memory implementation of IFileSystem. Useful for testing, prototyping, and browser environments.
Additional Interfaces
IProvider— Base provider with capability discoveryIObjectStorage— S3-compatible object storage operationsIGitRepo— Git repository operations (branches, commits, tags)IGitHost— Git hosting platform operations (PRs, issues, releases)
License
MIT
