From dde7b36c465eba4f8810ef8021603064bc3cc261 Mon Sep 17 00:00:00 2001 From: Chris Rabl Date: Mon, 24 Jul 2017 10:53:41 -0600 Subject: [PATCH] feat(typings): add TypeScript .d.ts files * created outline for TypeScript declarations * added basic object shapes for FtpServer and FileSystem --- ftp-srv.d.ts | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 63 insertions(+) create mode 100644 ftp-srv.d.ts 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"