Synchronous file system operations — a JVM mirror of bun.fs. Paths are
strings in, strings out (no java.nio.Path leakage); failures throw
Node-style ex-info (:type :fs-error, :code ENOENT/EACCES/…). See
docs/MIRROR.md for the parity contract.
Synchronous file system operations — a JVM mirror of `bun.fs`. Paths are strings in, strings out (no `java.nio.Path` leakage); failures throw Node-style `ex-info` (`:type :fs-error`, `:code` ENOENT/EACCES/…). See `docs/MIRROR.md` for the parity contract.
(copy src dest)Copies the file at src to dest, byte for byte. Returns nil.
Overwrites dest unconditionally — bun calls copyFileSync without
COPYFILE_EXCL, so there is no exclusive-create option to mirror. Does NOT
create dest's parent directory; a missing parent is ENOENT, as in bun.
REPLACE_EXISTING alone (not COPY_ATTRIBUTES) is what matches bun here:
both leave dest carrying src's permission mode but a fresh mtime, since
libuv's copyfile opens the destination with the source's mode.
The ex-data :path on failure is src even when dest is what failed —
bun wraps the whole call against the source path, and the mirror follows.
Copies the file at `src` to `dest`, byte for byte. Returns nil. Overwrites `dest` unconditionally — bun calls `copyFileSync` without `COPYFILE_EXCL`, so there is no exclusive-create option to mirror. Does NOT create `dest`'s parent directory; a missing parent is ENOENT, as in bun. `REPLACE_EXISTING` alone (not `COPY_ATTRIBUTES`) is what matches bun here: both leave `dest` carrying `src`'s permission mode but a fresh mtime, since libuv's copyfile opens the destination with the source's mode. The ex-data `:path` on failure is `src` even when `dest` is what failed — bun wraps the whole call against the source path, and the mirror follows.
(cwd)Returns the current working directory.
Returns the current working directory.
(delete path)Deletes a file. Ignores missing files (rm -f). Returns nil.
Deletes a file. Ignores missing files (rm -f). Returns nil.
(directory? path)Returns true if path is a directory. Mirrors bun.fs/directory? Never throws — returns false on missing path.
Returns true if path is a directory. Mirrors bun.fs/directory? Never throws — returns false on missing path.
(dirname p)Returns the directory portion of a path. Does NOT resolve relative paths. Returns "." for empty string and bare filenames, "/" for the root, and "/" for a single-segment path under root (e.g. (dirname "/foo") => "/"). Strips all trailing slashes — (dirname "/a/b/c//") => "/a/b" — matching node:path.dirname.
Approximate parity: POSIX double-slash root (e.g. (dirname "//foo") returns "//" under Node) is NOT preserved; bushka collapses to "/". Kiln M1 never feeds such inputs. See MIRROR.md.
Returns the directory portion of a path. Does NOT resolve relative paths. Returns "." for empty string and bare filenames, "/" for the root, and "/" for a single-segment path under root (e.g. (dirname "/foo") => "/"). Strips all trailing slashes — (dirname "/a/b/c//") => "/a/b" — matching node:path.dirname. Approximate parity: POSIX double-slash root (e.g. (dirname "//foo") returns "//" under Node) is NOT preserved; bushka collapses to "/". Kiln M1 never feeds such inputs. See MIRROR.md.
(exists? path)Returns true if path exists. Mirrors bun.fs/exists? Never throws — returns false on any access error or missing path.
Returns true if path exists. Mirrors bun.fs/exists? Never throws — returns false on any access error or missing path.
(mkdir path)Creates directory and any missing parents. Mirrors bun.fs/mkdir (recursive: true). Idempotent — does not throw if the directory already exists. Returns nil.
Creates directory and any missing parents. Mirrors bun.fs/mkdir (recursive: true). Idempotent — does not throw if the directory already exists. Returns nil.
(path & segments)Joins and resolves path segments. Returns absolute path string. Mirrors node:path.resolve — walks segments left-to-right, restarting the accumulator from any absolute segment, then resolves the remainder against CWD if no absolute segment was seen. (path "/a" "/b") => "/b".
Joins and resolves path segments. Returns absolute path string. Mirrors node:path.resolve — walks segments left-to-right, restarting the accumulator from any absolute segment, then resolves the remainder against CWD if no absolute segment was seen. (path "/a" "/b") => "/b".
(read-edn path)Reads and parses EDN file. Mirrors bun.fs/read-edn.
Reads and parses EDN file. Mirrors bun.fs/read-edn.
(readdir path)Returns vec of filenames (not full paths) in directory. Mirrors bun.fs/readdir.
Returns vec of filenames (not full paths) in directory. Mirrors bun.fs/readdir.
(relative from to)Return the relative path from from to to. Mirrors node:path.relative:
both inputs are resolved to absolute paths against CWD before relativizing.
Required for Java parity — JVM's Path.relativize throws
IllegalArgumentException on mixed abs/rel inputs, whereas Node returns
a string.
Return the relative path from `from` to `to`. Mirrors node:path.relative: both inputs are resolved to absolute paths against CWD before relativizing. Required for Java parity — JVM's Path.relativize throws IllegalArgumentException on mixed abs/rel inputs, whereas Node returns a string.
(slurp path & {:keys [encoding] :or {encoding "utf-8"}})Reads file content as string. Options: :encoding (default "utf-8").
Reads file content as string. Options: :encoding (default "utf-8").
(slurp-bytes path)Reads file content as a byte array.
Exists so callers can carry content that is not valid UTF-8: slurp decodes
and throws MalformedInputException on such input, slurp-bytes never decodes.
Approximate parity: bun returns a Uint8Array, whose elements are unsigned
(0..255); the JVM analogue is a primitive byte[], whose elements are signed
(-128..127). The bytes on disk are identical — only the element type a caller
reads them through differs. See MIRROR.md.
Reads file content as a byte array. Exists so callers can carry content that is not valid UTF-8: `slurp` decodes and throws MalformedInputException on such input, `slurp-bytes` never decodes. Approximate parity: bun returns a `Uint8Array`, whose elements are unsigned (0..255); the JVM analogue is a primitive `byte[]`, whose elements are signed (-128..127). The bytes on disk are identical — only the element type a caller reads them through differs. See MIRROR.md.
(spit path
content
&
{:keys [append encoding] :or {append false encoding "utf-8"}})Writes content to file. Returns nil. Options: :append (default false), :encoding (default "utf-8").
Writes content to file. Returns nil. Options: :append (default false), :encoding (default "utf-8").
(spit-bytes path data)Writes a byte array to file, truncating any existing content. Returns nil.
The write half of the slurp-bytes pair — takes a primitive byte[] where
bun takes a Uint8Array. See slurp-bytes for the element-signedness note.
Writes a byte array to file, truncating any existing content. Returns nil. The write half of the `slurp-bytes` pair — takes a primitive `byte[]` where bun takes a `Uint8Array`. See `slurp-bytes` for the element-signedness note.
(symlink target link-path)Creates a symlink at link-path pointing to target. Returns nil. Mirrors bun.fs/symlink — arg order is [target link-path] (bun's), reversed from JVM Files/createSymbolicLink(link, target). target need not exist (a dangling symlink is allowed).
Creates a symlink at link-path pointing to target. Returns nil. Mirrors bun.fs/symlink — arg order is [target link-path] (bun's), reversed from JVM Files/createSymbolicLink(link, target). target need not exist (a dangling symlink is allowed).
(symlink? path)Returns true if path is a symbolic link, without following it. Mirrors bun.fs/symlink? (lstatSync().isSymbolicLink()): true for a symlink — including a dangling one — false for a real file/dir. Throws fs-error ENOENT when no entry exists at path (lstat semantics, via NOFOLLOW_LINKS).
Returns true if path is a symbolic link, without following it. Mirrors bun.fs/symlink? (lstatSync().isSymbolicLink()): true for a symlink — including a dangling one — false for a real file/dir. Throws fs-error ENOENT when no entry exists at path (lstat semantics, via NOFOLLOW_LINKS).
(temp-dir prefix)Creates a temporary directory with the given prefix. Returns its path. Mirrors bun.fs/temp-dir.
Creates a temporary directory with the given prefix. Returns its path. Mirrors bun.fs/temp-dir.
(write-edn path data)Writes data as EDN to a file. Returns nil.
Writes data as EDN to a file. Returns nil.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |