Skip to content

Class: RemoteFs ​

Filesystem operations on the remote host. Only available when the connection uses SFTP, because the SCP protocol has no way to list, stat, rename or delete.

Methods ​

exists() ​

ts
exists(path): Promise<false | EntryType>;

Returns the entry type, or false when nothing exists at path. Symlinks are followed, so 'symlink' means a link whose target is missing. Other errors throw.

Parameters ​

ParameterType
pathstring

Returns ​

Promise<false | EntryType>


list() ​

ts
list(path): Promise<RemoteEntry[]>;

Lists a directory, without . and .., sorted by name.

Parameters ​

ParameterType
pathstring

Returns ​

Promise<RemoteEntry[]>


lstat() ​

ts
lstat(path): Promise<RemoteStats>;

Stats path without following a final symlink.

Parameters ​

ParameterType
pathstring

Returns ​

Promise<RemoteStats>


mkdir() ​

ts
mkdir(path, options?): Promise<void>;

Creates a directory. With recursive, creates missing parents too, like mkdir -p.

Parameters ​

ParameterType
pathstring
optionsMkdirOptions

Returns ​

Promise<void>


realpath() ​

ts
realpath(path): Promise<string>;

Resolves path to an absolute path on the server, for example . to the home directory.

Parameters ​

ParameterType
pathstring

Returns ​

Promise<string>


rename() ​

ts
rename(from, to): Promise<void>;

Moves or renames from to to.

Parameters ​

ParameterType
fromstring
tostring

Returns ​

Promise<void>


rm() ​

ts
rm(path, options?): Promise<void>;

Deletes a file or symlink, or with recursive a directory and everything in it.

Parameters ​

ParameterType
pathstring
optionsRmOptions

Returns ​

Promise<void>


stat() ​

ts
stat(path): Promise<RemoteStats>;

Stats path, following symlinks.

Parameters ​

ParameterType
pathstring

Returns ​

Promise<RemoteStats>

Released under the MIT License.