@suaveplan/drive - Modular virtual filesystem core for Suaveplan. File-level operations over AbstractStorage with a plugin slot for middleware, chunking, encryption, and P2P mesh.
Summary
Modular virtual filesystem core for Suaveplan. File-level operations over AbstractStorage with a plugin slot for middleware, chunking, encryption, and P2P mesh.
Documentation tree
- drive — Core
Driveclass — a virtual filesystem overAbstractStoragewith plugin and middleware support.- drive — Core
Driveclass — a virtual filesystem overAbstractStoragewith plugin and middleware support. - file-location-index — Implements
FileLocationIndex, the in-memory map populated byDrive.hydrateFromand consulted by `Drive.getKeyStatus… - get-key-status — Implements
Drive.getKeyStatus(path), the synchronous three-state lock-icon lookup (DTP-22). Returns'unencrypted',… - get-presence — Implements
Drive.getPresence(path), the chunk-level progress lookup (DTP-23). Returns theChunkPresenceshape (`chu… - hydrate-from — Implements
Drive.hydrateFrom(template, options), the orchestrator that turns a server-signedDriveTemplateinto a p…
- drive — Core
- error-codes — Defines the structured error registry for
@suaveplan/drive. Every failure mode the package can produce is registered…- error-codes — Defines the structured error registry for
@suaveplan/drive. Every failure mode the package can produce is registered…
- error-codes — Defines the structured error registry for
- delete — Implements the deletion helper that powers
Drive.delete(path, signal?). Delegates to the underlying `DriveStorage.del… - list — Implements the listing helper that powers
Drive.list(prefix?, options?). Delegates to the underlying `DriveStorage.li… - read — Implements the byte-reading helper that powers
Drive.read(path, options?). Delegates to the underlying `DriveStorage.… - stat — Implements the metadata helper that powers
Drive.stat(path, signal?). Delegates to the underlying `DriveStorage.getMe… - streams — Implements
createReadStreamandcreateWriteStreamforDrive. Each function inspects the storage's `capabilities.n… - write — Implements the byte-writing helper that powers
Drive.write(path, data, options?). Delegates to the underlying `DriveS… - plugins — (no submodules)
- registry — (no submodules)
- schemas — (no submodules)
- drive-options.schema — (no submodules)
- registry — (no submodules)- schemas — (no submodules)- drive-options.schema — (no submodules)- error-codes — Defines the structured error registry for
@suaveplan/drive. Every failure mode the package can produce is registered… - registry — (no submodules)- schemas — (no submodules)- drive-options.schema — (no submodules)- error-codes — Defines the structured error registry for
@suaveplan/drive. Every failure mode the package can produce is registered… - registry — (no submodules)- schemas — (no submodules) - drive-options.schema — (no submodules)- error-codes — Defines the structured error registry for
@suaveplan/drive. Every failure mode the package can produce is registered…
Install
bun add @suaveplan/drive
Quick start
import { Drive } from "@suaveplan/drive";
import { MemoryStorage } from "@suaveplan/storage/memory";
const storage = Object.assign(new MemoryStorage(), { id: "local" });
const drive = new Drive(storage);
await drive.initialize();
await drive.write("hello.txt", new TextEncoder().encode("world"));
const data = await drive.read("hello.txt");
console.log(new TextDecoder().decode(data)); // "world"
await drive.dispose();
Modules
- src/drive/drive.md —
Driveclass, lifecycle, and file operations - src/error-codes.md —
DriveErrorandDRIVE_CODESregistry - src/types/drive.types.md — public TypeScript interfaces
- src/schemas/drive-options.schema.md — Zod boundary schemas
- src/file-operations/read.md — read operation
- src/file-operations/write.md — write operation
- src/file-operations/delete.md — delete operation
- src/file-operations/stat.md — metadata retrieval
- src/file-operations/list.md — list operation
- src/file-operations/streams.md — stream creation
- src/plugins/registry.md — plugin and middleware registry