Filesystem and Paths
Use Path rather than manual string concatenation when composing filesystem paths.
import process
import fs
let root = process.cwd()?
let config = root.join("config.json")
let text = fs.read(config)?
Inspect path components:
config.name()
config.stem()
config.extension()
config.parent()
Check filesystem state:
if config.exists() {
print(fs.read(config)?)
}
Convert a path to a string only at API boundaries that specifically require text:
config.to_str()