@ende/fs

ende add jsr:@ende/fs

Version 2026.10.15 on JSR.

Helpers for working with the filesystem.

import { ensureFile, copy, ensureDir, move } from "@ende/fs";

await ensureFile("example.txt");

await copy("example.txt", "example_copy.txt");

await ensureDir("subdir");

await move("example_copy.txt", "subdir/example_copy.txt");

Modules

Exports

  • copy — Asynchronously copy a file or directory (along with its contents), like cp -r.
  • CopyOptions — Options for copy and copySync.
  • copySync — Synchronously copy a file or directory (along with its contents), like cp -r.
  • CRLF — End-of-line character for Windows platforms.
  • detect — Returns the detected EOL character(s) detected in the input string. If no EOL character is detected, `null` is returned.
  • emptyDir — Asynchronously ensures that a directory is empty.
  • emptyDirSync — Synchronously ensures that a directory is empty deletes the directory contents it is not empty.
  • ensureDir — Asynchronously ensures that the directory exists, like mkdir -p.
  • ensureDirSync — Synchronously ensures that the directory exists, like mkdir -p.
  • ensureFile — Asynchronously ensures that the file exists.
  • ensureFileSync — Synchronously ensures that the file exists.
  • ensureLink — Asynchronously ensures that the hard link exists.
  • ensureLinkSync — Synchronously ensures that the hard link exists.
  • ensureSymlink — Asynchronously ensures that the link exists, and points to a valid file.
  • ensureSymlinkSync — Synchronously ensures that the link exists, and points to a valid file.
  • EOL — End-of-line character evaluated for the current platform.
  • exists — Asynchronously test whether or not the given path exists by checking with the file system.
  • ExistsOptions — Options for exists and existsSync.
  • existsSync — Synchronously test whether or not the given path exists by checking with the file system.
  • expandGlob — Returns an async iterator that yields each file path matching the given glob pattern.
  • ExpandGlobOptions — Options for expandGlob and expandGlobSync.
  • expandGlobSync — Returns an iterator that yields each file path matching the given glob pattern. The file paths are relative to the provided `root` directory. If `root` is not provided, the current working directory is used. The `root` directory is not included in the yielded file paths.
  • format — Normalize the input string to the targeted EOL.
  • GlobOptions — Options for globToRegExp, joinGlobs, normalizeGlob and expandGlob.
  • LF — End-of-line character for POSIX platforms such as macOS and Linux.
  • move — Asynchronously moves a file or directory (along with its contents).
  • MoveOptions — Options for move and moveSync.
  • moveSync — Synchronously moves a file or directory (along with its contents).
  • walk — Recursively walks through a directory and yields information about each file and directory encountered.
  • WalkEntry — Walk entry for walk, walkSync, expandGlob and expandGlobSync.
  • WalkOptions — Options for walk and walkSync.
  • walkSync — Recursively walks through a directory and yields information about each file and directory encountered.