@jsvision/files / FileSystem
Interface: FileSystem
Defined in: files/src/fs/types.ts:45
The injectable filesystem the dialogs read and write through. Implement it to point the family at a virtual or remote tree; the path methods mirror node:path, the read methods mirror node:fs, and roots/homedir abstract over the platform. Every method is synchronous.
Properties
sep
readonlysep:string
Defined in: files/src/fs/types.ts:67
The platform path separator ('/' on POSIX, '\\' on Windows).
Methods
basename()
basename(
path):string
Defined in: files/src/fs/types.ts:65
The final segment of a path (like node:path.basename).
Parameters
path
string
Returns
string
dirname()
dirname(
path):string
Defined in: files/src/fs/types.ts:63
The parent directory of a path (like node:path.dirname).
Parameters
path
string
Returns
string
homedir()
homedir():
string
Defined in: files/src/fs/types.ts:69
The user's home directory (like os.homedir()).
Returns
string
isAbsolute()
isAbsolute(
path):boolean
Defined in: files/src/fs/types.ts:59
Whether the path is absolute (like node:path.isAbsolute).
Parameters
path
string
Returns
boolean
join()
join(...
segments):string
Defined in: files/src/fs/types.ts:61
Join path segments (like node:path.join).
Parameters
segments
...string[]
Returns
string
lstat()
lstat(
path):FileStat
Defined in: files/src/fs/types.ts:55
Describe a path without following symlinks, so a link is reported as a link.
Parameters
path
string
Returns
readDir()
readDir(
path):DirEntry[]
Defined in: files/src/fs/types.ts:51
List one directory. Each entry is tagged by its own type (a symlink stays a symlink, with its target's size/mtime and a broken flag). A permission error on a single entry skips just that entry; a failure to open the directory itself throws (the dialog turns that into an error box).
Parameters
path
string
Returns
DirEntry[]
readFile()
readFile(
path):string
Defined in: files/src/fs/types.ts:73
Read a file as UTF-8 text. Throws if the file is missing or unreadable.
Parameters
path
string
Returns
string
rename()
rename(
from,to):void
Defined in: files/src/fs/types.ts:77
Rename or move a file. Throws if the source is missing.
Parameters
from
string
to
string
Returns
void
resolve()
resolve(...
segments):string
Defined in: files/src/fs/types.ts:57
Absolutize and normalize the joined segments (like node:path.resolve).
Parameters
segments
...string[]
Returns
string
roots()
roots():
string[]
Defined in: files/src/fs/types.ts:71
The filesystem roots — ['/'] on POSIX; the available drive letters on Windows.
Returns
string[]
stat()
stat(
path):FileStat
Defined in: files/src/fs/types.ts:53
Describe a path, following symlinks to their target. Throws if the target is missing or unreadable.
Parameters
path
string
Returns
unlink()
unlink(
path):void
Defined in: files/src/fs/types.ts:79
Delete a file. Throws if it is missing (the editor swallows this on a first-time .bak).
Parameters
path
string
Returns
void
writeFile()
writeFile(
path,text):void
Defined in: files/src/fs/types.ts:75
Write UTF-8 text to a file, creating or replacing it.
Parameters
path
string
text
string
Returns
void