mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
|
|
|
|
import { Readable } from 'stream';
|
|
import { EventEmitter } from 'events';
|
|
|
|
declare namespace JSFtp {
|
|
|
|
|
|
interface JSFtpOptions {
|
|
host: string;
|
|
port?: number | 21;
|
|
user?: string | 'anonymous';
|
|
pass?: string | '@anonymous';
|
|
useList?: boolean
|
|
}
|
|
|
|
interface Callback<T> {
|
|
(err: any, result: T): void;
|
|
}
|
|
|
|
|
|
interface Entry {
|
|
name: string;
|
|
size: number;
|
|
time: number;
|
|
type: 0 | 1;
|
|
}
|
|
}
|
|
|
|
interface JSFtp extends EventEmitter {
|
|
auth(user: string, password: string, callback: JSFtp.Callback<void>): void
|
|
keepAlive(wait?: number): void;
|
|
ls(path: string, callback: JSFtp.Callback<JSFtp.Entry[]>): void;
|
|
list(path: string, callback: JSFtp.Callback<any>): void;
|
|
put(buffer: Buffer, path: string, callback: JSFtp.Callback<void>): void;
|
|
get(path: string, callback: JSFtp.Callback<Readable>): void;
|
|
setType(type: 'A' | 'AN' | 'AT' | 'AC' | 'E' | 'I' | 'L', callback: JSFtp.Callback<any>): void;
|
|
raw(command: string, args: any[], callback: JSFtp.Callback<void>): void;
|
|
raw<T>(command: string, args: any[], callback: JSFtp.Callback<T>): void;
|
|
}
|
|
|
|
interface JSFtpConstructor {
|
|
new(options: JSFtp.JSFtpOptions): JSFtp;
|
|
}
|
|
|
|
declare const JSFtp: JSFtpConstructor;
|
|
|
|
export = JSFtp;
|