Skip to content

Commit

Permalink
feat(typings): add TypeScript .d.ts files
Browse files Browse the repository at this point in the history
* created outline for TypeScript declarations
* added basic object shapes for FtpServer and FileSystem
  • Loading branch information
crabl committed Jul 24, 2017
1 parent 00af9e7 commit dde7b36
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions ftp-srv.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
declare class FileSystem {
constructor(connection: any, {root, cwd}?: {
root: any;
cwd: any;
});

currentDirectory(): string;

get(fileName: string): Promise<any>;

list(path?: string): Promise<any>;

chdir(path?: string): Promise<string>;

write(fileName: string, {append, start}?: {
append?: boolean;
start?: any;
}): any;

read(fileName: string, {start}?: {
start?: any;
}): Promise<any>;

delete(path: string): Promise<any>;

mkdir(path: string): Promise<any>;

rename(from: string, to: string): Promise<any>;

chmod(path: string, mode: string): Promise<any>;

getUniqueName(): string;
}

declare class FtpServer {
constructor(url: string, options?: {});

readonly isTLS: boolean;

listen(): any;

emitPromise(action: any, ...data: any[]): Promise<any>;

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<any>;

close(): any;
}

declare const FtpSrv: FtpServer;
export default FtpServer;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit dde7b36

Please sign in to comment.