diff --git a/ftp-srv.d.ts b/ftp-srv.d.ts new file mode 100644 index 00000000..90b6d382 --- /dev/null +++ b/ftp-srv.d.ts @@ -0,0 +1,62 @@ +declare class FileSystem { + constructor(connection: any, {root, cwd}?: { + root: any; + cwd: any; + }); + + currentDirectory(): string; + + get(fileName: string): Promise; + + list(path?: string): Promise; + + chdir(path?: string): Promise; + + write(fileName: string, {append, start}?: { + append?: boolean; + start?: any; + }): any; + + read(fileName: string, {start}?: { + start?: any; + }): Promise; + + delete(path: string): Promise; + + mkdir(path: string): Promise; + + rename(from: string, to: string): Promise; + + chmod(path: string, mode: string): Promise; + + getUniqueName(): string; +} + +declare class FtpServer { + constructor(url: string, options?: {}); + + readonly isTLS: boolean; + + listen(): any; + + emitPromise(action: any, ...data: any[]): Promise; + + emit(action: any, ...data: any[]): void; + + setupTLS(_tls: boolean): boolean | { + cert: string; + key: string; + ca: string + }; + + setupGreeting(greet: string): string[]; + + setupFeaturesMessage(): string; + + disconnectClient(id: string): Promise; + + close(): any; +} + +declare const FtpSrv: FtpServer; +export default FtpServer; diff --git a/package.json b/package.json index 05d55719..bb6687b6 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "verify:js:watch": "chokidar 'src/**/*.js' 'test/**/*.js' 'config/**/*.js' -c 'npm run verify:js:fix' --initial --silent", "verify:watch": "npm run verify:js:watch --silent" }, + "types": "./ftp-srv.d.ts", "config": { "commitizen": { "path": "node_modules/cz-customizable"