FTP
#导入
通过如下方式导入ftp api
import ftp from "svr-api/ftp";
#方法
/**
 * ftp服务器相关API
 */
import { FtpClient } from "./types/ftp.types";
/**
 * 创建一个ftp客户端连接
 * @param args 
 */
export function connectFTP(args: {
	/**ftp服务器地址 */
	host: string;
	/**ftp服务器端口 */
	port: number;
	/**ftp登录用户名 */
	username: string;
	/**ftp登录密码 */
	password: string
}): FtpClient;
#对象
/**
 * 此文件定义一些ftp客户端的相关的数据类型。
 * 
 */
import { File } from "svr-api/fs";
/**
 * 一个ftp链接对象,创建一次可多次复用,用于连续多次的和同一个服务器进行文件的交互。
 */
declare interface FtpClient {
	/** Emitted when the connection has fully closed.*/
	close(): void;
	/** Changes the current working directory to path. */
	cwd(path: string): void;
	/** Creates a new directory, path, on the server. */
	mkdir(path: string): boolean;
	/** Removes a directory, path, on the server. If recursive, this call will delete the contents of the directory if it is not empty. */
	rmdir(path: string, recursive: boolean): boolean;
	/** Renames oldPath to newPath on the server */
	rename(oldPath: string, newPath: string): boolean;
	/** Retrieves the size of path */
	size(path: string): number
	/** Retrieves the directory listing of path*/
	list(path: string): Array<{ filename: string; size: number; type: string }>;
	/** Sends data to the server to be stored as remotePath. localFilePath is a path to a local file. */
	put(remotePath: string, localFilePath: string): boolean;
	/** Retrieves a file at path from the server. */
	get(path: string): File;
	/** Deletes a file, path, on the server. */
	del(path: string): boolean;
}