fs
import "osl/fs"Reading & writing files
fs.readFile(path) → string
fs.readFile(path) → stringstring text = fs.readFile("notes.txt")fs.readFileBytes(path) → bytes
fs.readFileBytes(path) → bytesfs.writeFile(path, data) → boolean
fs.writeFile(path, data) → booleanfs.writeFile("out.txt", "hello world")fs.writeFileBytes(path, data) → boolean
fs.writeFileBytes(path, data) → booleanfs.appendToFile(path, data) → boolean
fs.appendToFile(path, data) → booleanFiles & directories
fs.exists(path) → boolean
fs.exists(path) → booleanfs.isDir(path) → boolean
fs.isDir(path) → booleanfs.remove(path) → boolean
fs.remove(path) → booleanfs.rename(oldPath, newPath) → boolean
fs.rename(oldPath, newPath) → booleanfs.mkdir(path) → boolean
fs.mkdir(path) → booleanfs.mkdirAll(path) → boolean
fs.mkdirAll(path) → booleanfs.copyDir(srcPath, dstPath) → boolean
fs.copyDir(srcPath, dstPath) → booleanfs.readDir(path) → array
fs.readDir(path) → arrayfs.readDirAll(path) → array
fs.readDirAll(path) → arrayfs.walk(path) → array
fs.walk(path) → arrayfs.getwd() → string
fs.getwd() → stringfs.chdir(path) → boolean
fs.chdir(path) → booleanFile metadata
fs.getSize(path) → number
fs.getSize(path) → numberfs.getModTime(path) → number
fs.getModTime(path) → numberfs.getStat(path) → object
fs.getStat(path) → objectfs.evalSymlinks(path) → string
fs.evalSymlinks(path) → stringPath utilities
fs.joinPath(...path) → string
fs.joinPath(...path) → stringfs.getBase(path) → string
fs.getBase(path) → stringfs.getDir(path) → string
fs.getDir(path) → stringfs.getExt(path) → string
fs.getExt(path) → stringfs.getStem(path) → string
fs.getStem(path) → stringfs.getParts(path) → array
fs.getParts(path) → arrayfs.cleanPath(path) → string
fs.cleanPath(path) → stringfs.isAbs(path) → boolean
fs.isAbs(path) → booleanfs.splitPath(path) → array
fs.splitPath(path) → arrayfs.splitExt(path) → array
fs.splitExt(path) → arrayfs.segments(path) → array
fs.segments(path) → arrayfs.withExt(path, ext) → string
fs.withExt(path, ext) → stringfs.withName(path, name) → string
fs.withName(path, name) → stringfs.toPosix(path) → string
fs.toPosix(path) → stringfs.relPath(base, target) → string
fs.relPath(base, target) → stringfs.pathStartsWith(path, prefix) → boolean
fs.pathStartsWith(path, prefix) → booleanResult-returning variants
fs.tryReadFile(path) → result
fs.tryReadFile(path) → resultfs.tryWriteFile(path, data) → result
fs.tryWriteFile(path, data) → resultfs.tryAppendToFile(path, data) → result
fs.tryAppendToFile(path, data) → resultfs.tryRename(oldPath, newPath) → result
fs.tryRename(oldPath, newPath) → resultfs.tryRemove(path) → result
fs.tryRemove(path) → resultfs.tryMkdirAll(path) → result
fs.tryMkdirAll(path) → resultfs.tryReadDir(path) → result
fs.tryReadDir(path) → resultComplete API reference
fs
fsMethod
Returns
Description
Notes
Last updated