Skip to content

Repository files navigation

@bounded-systems/fs

The filesystem capability seam — the one allowed filesystem-access point, behind an injectable FileSystem.

Production code depends on the FileSystem interface, not on node:fs directly. The default implementation is the real filesystem; a test (or a sandbox) injects its own, so disk access is both enumerable and substitutable.

Install

npm install @bounded-systems/fs

Usage

import{defaultFileSystem,statPath,removeFile,typeFileSystem,typeFileStat,}from"@bounded-systems/fs";// Depend on the port; default to the real filesystem.asyncfunctionload(fs: FileSystem=defaultFileSystem){conststat: FileStat|null=awaitstatPath(fs,"config.json");// …}// In a test, pass an in-memory FileSystem instead.

Design

  • Capability seam. Callers receive a FileSystem rather than reaching for node:fs, so filesystem access is injectable and auditable.
  • Leaf package. Touches node builtins only and carries no ambient authority beyond the filesystem it mediates — an extractability test enforces it.

License

MIT © Bounded Systems

About

Filesystem capability seam; the one allowed filesystem-access point with an injectable FileSystem

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages