legion-fs

File system utilities for legionhjyu. Read, write, watch, and traverse files and directories with a clean, consistent API.

v1.1.5 MIT @legionhjyu Updated NaNy ago
Install
legion pkg install legion-fs

legion-fs

File system utilities for legionhjyu programs.

Install

legion pkg install legion-fs

Usage

summon "legion-fs" release fs

forge content <- fs.read("config.json") fs.write("output.txt", result)

forge files <- fs.list("./src", "*.lhj") fs.mkdir("build/output")

blade fs.exists("config.json") { shout("Config found") }

Functions

FunctionDescription
fs.read(path)Read file to string
fs.write(path, content)Write string to file
fs.append(path, content)Append to file
fs.exists(path)Check if path exists
fs.list(dir, glob)List files matching glob
fs.mkdir(path)Create directory (recursive)
fs.remove(path)Delete file or directory
fs.copy(src, dst)Copy file
fs.move(src, dst)Move/rename file
fs.stat(path)File metadata
fs.watch(path, fn)Watch for changes