root / HServer / 00.Server / 00.Program / node_modules / ftp-srv / ftp-srv.d.ts
이력 | 보기 | 이력해설 | 다운로드 (2.55 KB)
| 1 | 39 | HKM | import * as tls from 'tls' |
|---|---|---|---|
| 2 | import { Stats } from 'fs'
|
||
| 3 | |||
| 4 | export class FileSystem {
|
||
| 5 | |||
| 6 | readonly connection: FtpConnection; |
||
| 7 | readonly root: string; |
||
| 8 | readonly cwd: string; |
||
| 9 | |||
| 10 | constructor(connection: FtpConnection, {root, cwd}?: {
|
||
| 11 | root: any; |
||
| 12 | cwd: any; |
||
| 13 | }); |
||
| 14 | |||
| 15 | currentDirectory(): string; |
||
| 16 | |||
| 17 | get(fileName: string): Promise<any>; |
||
| 18 | |||
| 19 | list(path?: string): Promise<any>; |
||
| 20 | |||
| 21 | chdir(path?: string): Promise<string>; |
||
| 22 | |||
| 23 | write(fileName: string, {append, start}?: {
|
||
| 24 | append?: boolean; |
||
| 25 | start?: any; |
||
| 26 | }): any; |
||
| 27 | |||
| 28 | read(fileName: string, {start}?: {
|
||
| 29 | start?: any; |
||
| 30 | }): Promise<any>; |
||
| 31 | |||
| 32 | delete(path: string): Promise<any>; |
||
| 33 | |||
| 34 | mkdir(path: string): Promise<any>; |
||
| 35 | |||
| 36 | rename(from: string, to: string): Promise<any>; |
||
| 37 | |||
| 38 | chmod(path: string, mode: string): Promise<any>; |
||
| 39 | |||
| 40 | getUniqueName(): string; |
||
| 41 | } |
||
| 42 | |||
| 43 | export class FtpConnection {
|
||
| 44 | server: FtpServer; |
||
| 45 | id: string; |
||
| 46 | log: any; |
||
| 47 | transferType: string; |
||
| 48 | encoding: string; |
||
| 49 | bufferSize: boolean; |
||
| 50 | readonly ip: string; |
||
| 51 | restByteCount: number | undefined; |
||
| 52 | secure: boolean |
||
| 53 | |||
| 54 | close (code: number, message: number): Promise<any> |
||
| 55 | login (username: string, password: string): Promise<any> |
||
| 56 | reply (options: number | Object, ...letters: Array<any>): Promise<any> |
||
| 57 | |||
| 58 | } |
||
| 59 | |||
| 60 | export interface FtpServerOptions {
|
||
| 61 | pasv_range?: number | string, |
||
| 62 | greeting?: string | string[], |
||
| 63 | tls?: tls.SecureContext | false, |
||
| 64 | anonymous?: boolean, |
||
| 65 | blacklist?: Array<string>, |
||
| 66 | whitelist?: Array<string>, |
||
| 67 | file_format?: (stat: Stats) => string | Promise<string> | "ls" | "ep", |
||
| 68 | log?: any |
||
| 69 | } |
||
| 70 | |||
| 71 | export class FtpServer {
|
||
| 72 | constructor(url: string, options?: FtpServerOptions); |
||
| 73 | |||
| 74 | readonly isTLS: boolean; |
||
| 75 | |||
| 76 | listen(): any; |
||
| 77 | |||
| 78 | emitPromise(action: any, ...data: any[]): Promise<any>; |
||
| 79 | |||
| 80 | emit(action: any, ...data: any[]): void; |
||
| 81 | |||
| 82 | setupTLS(_tls: boolean): boolean | {
|
||
| 83 | cert: string; |
||
| 84 | key: string; |
||
| 85 | ca: string |
||
| 86 | }; |
||
| 87 | |||
| 88 | setupGreeting(greet: string): string[]; |
||
| 89 | |||
| 90 | setupFeaturesMessage(): string; |
||
| 91 | |||
| 92 | disconnectClient(id: string): Promise<any>; |
||
| 93 | |||
| 94 | close(): any; |
||
| 95 | |||
| 96 | on(event: "login", listener: ( |
||
| 97 | data: {
|
||
| 98 | connection: FtpConnection, |
||
| 99 | username: string, |
||
| 100 | password: string |
||
| 101 | }, |
||
| 102 | resolve: (config: {
|
||
| 103 | fs?: FileSystem, |
||
| 104 | root?: string, |
||
| 105 | cwd?: string, |
||
| 106 | blacklist?: Array<string>, |
||
| 107 | whitelist?: Array<string> |
||
| 108 | }) => void, |
||
| 109 | reject: (err?: Error) => void |
||
| 110 | ) => void) |
||
| 111 | |||
| 112 | on(event: "client-error", listener: ( |
||
| 113 | data: {
|
||
| 114 | connection: FtpConnection, |
||
| 115 | context: string, |
||
| 116 | error: Error, |
||
| 117 | } |
||
| 118 | ) => void) |
||
| 119 | } |
||
| 120 | |||
| 121 | export {FtpServer as FtpSrv};
|
||
| 122 | export default FtpServer; |