jiwonz/pathfs
v0.6.0 ·
luau-path + @lune/fs with some utilities
Features
- Includes typed
luau-path
utility (now fully typed) - @lune/fs library but supports path objects (
AsPath
objects which include string andPath
objects) - Does not require
node
&npm
anymore (now dependencyluau_path
is published to pesde!) - Includes runtime type checkers via greentea.
- Features useful path and fs related utilities (such as
watchFile
,Directory
,diff
and more!)
Installation
Install via pesde
pesde add jiwonz/pathfs -t lune
Usage
local pathfs = require("../lune_packages/pathfs")
local fs = pathfs.fs -- compat with lune's fs lib (@lune/fs)
fs.writeFile("something.json", "{ \"message\": \"Hello, world!\" }")
-- Using Path
local Path = pathfs.Path
local path = Path.from("something.json")
print(fs.readFile(path))
-- Some useful utilities
pathfs.script()
pathfs.normalize("./dirty/./path")
pathfs.absolute("relative/file/path")
pathfs.withoutCurDir("./to/remove/curdir/the/dot")
pathfs.diff("target", "base")
pathfs.findFile("path/to/file")
pathfs.findDir("path/to/dir")
pathfs.watchFile("path/to/file", function()
print("changed")
end)
pathfs.watchDirectories({ "dir1", "dir2" }, function()
print("changed")
end)
pathfs.writeFileAll("a/b/c/d/lol", "hi")
Credits
- seaofvoices/luau-path - The base of this library and cool Path implementation for Luau
- ffrostfall/lunePackages - watch utilities base implementations
TO-DOs
- Docs
- Add utils tests
- Write CHANGELOG.md instead writing in README.md (maybe from v0.6.0)
- (automated via GitHub action) Release with a bundled module