@std/fs

Overview

Filesystem one-shots, file handles, and path helpers.

.rnx
import fs, { File, Path } from "@std/fs";

The bare fs name is sync and blocking; the Async suffix returns a Promise. Fallible operations return Result<T, String>; only File.open keeps the isOpen sentinel for a refused open.

When to use it

Reach for @std/fs when a program persists anything. Bare names are sync and blocking one-shots (readText/writeText/copy/remove) with *Async twins on the process-wide pool; File handles carry a cursor with seek/tell plus advisory locks; Path covers joins and queries; mmap maps files into unsafe memory.

Capabilities

  • One-shot read/write plus *Async twins
  • File handles with cursor and locks
  • Path helpers
  • Mmap address mapping

Symbols

  • class File — Buffered OS file handle with a cursor. Open with open or create
  • class FileStat — Metadata snapshot for one path, as reported by stat.
  • class FsBytesReq — Request bundle for one pooled byte read.
  • class FsCopyReq — Request bundle for one pooled copy.
  • class FsDirReq — Request bundle for one pooled directory listing or glob.
  • class FsMoveReq — Request bundle for one pooled move or rename.
  • class FsStatReq — Request bundle for one pooled stat call.
  • class FsTextReq — Request bundle for one pooled text read. The pool worker receives the
  • class FsWriteBytesReq — Request bundle for one pooled byte write. Bytes travel as an array
  • class FsWriteTextReq — Request bundle for one pooled text write.
  • class Mmap — Live memory mapping of a file or of anonymous pages.
  • class Path — Path strings plus read-only filesystem queries. The string helpers are
  • enum CopyMode
  • enum OpenMode
  • enum WriteMode
  • fn chmod()
  • fn copy()
  • fn copyAsync()
  • fn exists()
  • fn fileLockId()
  • fn fsPoolSize()
  • fn fsWorkers()
  • fn fsWriteModeOf()
  • fn fsync()
  • fn glob()
  • fn globAsync()
  • fn isDir()
  • fn isFile()
  • fn mkdir()
  • fn mkdirAll()
  • fn mmap()
  • fn mmapAnon()
  • fn move()
  • fn moveAsync()
  • fn readBytes()
  • fn readBytesAsync()
  • fn readDir()
  • fn readDirAsync()
  • fn readLink()
  • fn readText()
  • fn readTextAsync()
  • fn remove()
  • fn removeAll()
  • fn rename()
  • fn renameAsync()
  • fn setWorkers()
  • fn stat()
  • fn statAsync()
  • fn symlink()
  • fn truncate()
  • fn writeBytes()
  • fn writeBytesAsync()
  • fn writeText()
  • fn writeTextAsync()