mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-03 06:27:46 +08:00
30 lines
972 B
TypeScript
30 lines
972 B
TypeScript
import Client = require('ssh2-sftp-client');
|
|
import * as fs from 'fs';
|
|
const client = new Client();
|
|
|
|
client.connect({
|
|
host: 'asdb',
|
|
port: 1234,
|
|
privateKey: 'my private key rsa in openssh format',
|
|
readyTimeout: 1000,
|
|
}).then(() => null);
|
|
|
|
client.list('/remote/path').then(() => null);
|
|
|
|
client.get('/remote/path').then(stream => stream.read(0));
|
|
client.get('/remote/path', true, 'utf8').then(stream => stream.read(0));
|
|
client.get('/remote/path', true, null).then(stream => stream.read(0));
|
|
|
|
client.put('/local/path', '/remote/path').then(() => null);
|
|
client.put(new Buffer('content'), '/remote/path').then(() => null);
|
|
client.put(fs.createReadStream('Hello World'), '/remote/path').then(() => null);
|
|
|
|
client.mkdir('/remote/path/dir', true).then(() => null);
|
|
client.rmdir('/remote/path/dir', true).then(() => null);
|
|
|
|
client.delete('remote/path').then(() => null);
|
|
|
|
client.rename('/remote/from', '/remote/to').then(() => null);
|
|
|
|
client.end().then(() => null);
|