Open serkanyersen opened 8 years ago
it might help someone. Here are the definitions I'm using for typescript.
declare module "scp2" { interface ScpOptions { port?: number; host?: string; username?: string; password?: string; paths?: string; } interface attrs { size: number; uid: number; gid: number; mode: number | string; atime: number; mtime: number; } interface writeOptions { destination: string; content: string; attrs: attrs; source: string; } export class Client { constructor(options: ScpOptions); sftp(callback: (err: string, sftp: Client) => void); close(): void; mkdir(dir: string, attrs: attrs, callback: (err: string) => void); write(options: writeOptions, callback: (err: string) => void); upload(src: string, destination: string, callback: (err: string) => void); download(src: string, destination: string, callback: (err: string) => void); on(eventName: string, callback: () => void); } export interface client { defaults(options: ScpOptions); scp(fileName: string, options: ScpOptions | string, errCallback?: (err: string) => void); scp(fileName: string, options: ScpOptions | string, glob: string, errCallback?: (err: string) => void); } }
And now you can use it as
import { Client } from 'scp2'; let client = new Client({ port: 22 });
You just saved my day
It would be so great if this would be merged
it might help someone. Here are the definitions I'm using for typescript.
And now you can use it as