UNPKG

pure-js-sftp

Version:

A pure JavaScript SFTP client with revolutionary RSA-SHA2 compatibility fixes. Zero native dependencies, built on ssh2-streams with 100% SSH key support.

62 lines 2.83 kB
/** * Pure JS SFTP Client * A pure JavaScript SFTP client with no native dependencies * 100% API compatible with ssh2-sftp-client */ import { SFTPClientOptions, DirectoryEntry } from './sftp/ssh2-streams-client'; import { EventEmitter } from 'events'; import { Readable, Writable } from 'stream'; export interface FileInfo { type: 'd' | '-' | 'l'; name: string; size: number; modifyTime: number; accessTime: number; rights: { user: string; group: string; other: string; }; owner: number; group: number; } export type FileInfoType = 'd' | '-' | 'l'; export declare class SftpClient extends EventEmitter { private client; constructor(_name?: string); connect(config: SFTPClientOptions): Promise<void>; list(remotePath: string, filter?: (fileInfo: FileInfo) => boolean): Promise<FileInfo[]>; get(remotePath: string, dst?: string | Writable): Promise<string | Writable | Buffer>; put(input: string | Buffer | Readable, remotePath: string, options?: any): Promise<string>; delete(remotePath: string): Promise<void>; rename(oldPath: string, newPath: string): Promise<void>; mkdir(remotePath: string, recursive?: boolean): Promise<void>; rmdir(remotePath: string, recursive?: boolean): Promise<void>; exists(remotePath: string): Promise<false | FileInfoType>; stat(remotePath: string): Promise<import("./ssh/types").FileAttributes>; fastGet(remotePath: string, localPath: string, options?: any): Promise<string>; fastPut(localPath: string, remotePath: string, options?: any): Promise<string>; append(input: string | Buffer, remotePath: string, options?: any): Promise<string>; chmod(remotePath: string, mode: string | number): Promise<void>; realPath(remotePath: string): Promise<string>; uploadDir(srcDir: string, dstDir: string, options?: { filter?: (path: string, isDirectory: boolean) => boolean; }): Promise<void>; downloadDir(srcDir: string, dstDir: string, options?: { filter?: (path: string, isDirectory: boolean) => boolean; }): Promise<void>; end(): Promise<void>; listDirectory(path: string): Promise<DirectoryEntry[]>; openFile(path: string, flags?: number): Promise<Buffer<ArrayBufferLike>>; closeFile(handle: Buffer): Promise<void>; readFile(handle: Buffer, offset: number, length: number): Promise<Buffer<ArrayBufferLike>>; disconnect(): void; isReady(): boolean; } export default SftpClient; export * from './ssh/types'; export type { SFTPClientOptions } from './sftp/ssh2-streams-client'; export type { SSH2StreamsConfig } from './ssh/ssh2-streams-transport'; export { SSH2StreamsSFTPClient } from './sftp/ssh2-streams-client'; export { SSH2StreamsTransport } from './ssh/ssh2-streams-transport'; //# sourceMappingURL=index.d.ts.map