Skip to content

src/base-fs

Abstract FileSystem base: lifecycle, rooted POSIX paths, encoding, and portable fallbacks so a concrete backend only implements low-level I/O.

A new adapter typically overrides:

  • onInit / onClose (optional)
  • createRootDirectory when BaseFileSystemOptions.createRoot is set
  • toBackendPath when the backend needs non-POSIX separators
  • preparePath for post-resolve checks (e.g. symlink containment)
  • the *At primitives and isNotFoundError
  • optional try* hooks for native append / copy / move

This class is the repository reuse point for rooted path safety, lifecycle, portable errors, encoding, and fallback behavior. A backend should implement the low-level *At primitives here rather than recreate the public contract.