basic-sftp
Version:
🤹🏻♀️ A basic promise-based SFTP Client
26 lines (25 loc) • 1.28 kB
TypeScript
/// <reference types="node" />
export declare const Client: {
new (): {
/** Establishes the connection */
connect: (access: import("ssh2").ConnectConfig) => Promise<true>;
/** Reestablishes the connection */
reconnect: () => Promise<true>;
/** Get original `ssh2.sftp` connection */
getConnection: () => import("ssh2").SFTPWrapper;
/** Closes the connection */
end: () => Promise<true>;
/** Lists the contents of a directory */
ls: (location: string | Buffer) => Promise<import("ssh2").FileEntry[]>;
/** Get the type from path: File | Directory | null */
is: (path: string) => Promise<"File" | "Directory" | null>;
/** Creates the path recursively, if it does not exist */
ensureDir: (path: string) => Promise<true>;
/** Uploads a local file to the remote server */
uploadFile: (localPath: string, remotePath: string) => Promise<true>;
/** Downloads a remote file to the local workspace */
downloadFile: (remotePath: string, localPath: string) => Promise<true>;
/** Remove all files and directories from a directory, including the directory itself, if it exists */
unlink: (path: string) => Promise<true>;
};
};