本文整理汇总了TypeScript中ssh2.Client类的典型用法代码示例。如果您正苦于以下问题:TypeScript Client类的具体用法?TypeScript Client怎么用?TypeScript Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Client类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: Client
return new Promise<PromiseSFTP>((resolve, reject) => {
const client = new Client();
client.on("error", reject);
client.on("ready", () => {
client.sftp((err: Error, sftp: SFTPWrapper) => {
if (err) {
reject(err);
}
resolve(new PromiseSFTP(sftp, client));
});
});
client.connect(config);
});
开发者ID:linusnorton,项目名称:uk-rail-import,代码行数:16,代码来源:PromiseSFTP.ts
示例2:
conn.on('ready', () => {
console.log('Client :: ready');
conn.forwardIn('127.0.0.1', 8000, (err: Error) => {
if (err) throw err;
console.log('Listening for connections on server on port 8000!');
});
}).on('tcp connection', (info: any, accept: Function, reject: Function) => {
开发者ID:1drop,项目名称:DefinitelyTyped,代码行数:7,代码来源:ssh2-tests.ts
示例3:
conn.on('ready', () => {
console.log('Client :: ready');
conn.subsys('netconf', (err: Error, stream: ssh2.ClientChannel) => {
if (err) throw err;
stream.on('data', (data: any) => {
console.log(data);
}).write(xmlhello);
});
}).connect({
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:9,代码来源:ssh2-tests.ts
示例4: parent
conn2.exec('uptime', (err: Error, stream: ssh2.ClientChannel) => {
if (err) {
console.log('SECOND :: exec error: ' + err);
return conn1.end();
}
stream.on('end', () => {
conn1.end(); // close parent (and this) connection
}).on('data', (data: any) => {
console.log(data.toString());
});
});
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:11,代码来源:ssh2-tests.ts
示例5:
conn.on('ready', () => {
console.log('Client :: ready');
conn.sftp( (err: Error, sftp: any) => {
if (err) throw err;
sftp.readdir('foo', (err: Error, list: any) => {
if (err) throw err;
console.dir(list);
conn.end();
});
});
}).connect({
开发者ID:293yoshida,项目名称:DefinitelyTyped,代码行数:11,代码来源:ssh2-tests.ts
示例6: initialize
function initialize() {
conn = new Client();
conn.on('ready', function () {
console.log('conn::ready');
conn.exec('gerrit stream-events', function (err, stream) {
console.log('gerrit stream-events');
if (err) {
console.log('gerrit stream-events error', err);
return reConnect();
}
stream.on('close', () => {
console.log('stream::close');
});
stream.on('error', (err) => {
console.log('stream::error', err);
});
stream.on('data', (data) => {
console.log('stream::data', data + '');
pushData(data);
});
});
});
conn.on('close', (hadError) => {
console.log('conn::close');
});
conn.on('end', () => {
console.log('conn::end');
});
conn.on('error', (err) => {
console.log('conn::error', err + '');
conn.end();
reConnect();
});
connect();
}
开发者ID:adasq,项目名称:gerrit-native-notifications,代码行数:39,代码来源:ssh-stream.ts
示例7: reject
client.on("ready", () => {
client.sftp((err: Error, sftp: SFTPWrapper) => {
if (err) {
reject(err);
}
resolve(new PromiseSFTP(sftp, client));
});
});
开发者ID:linusnorton,项目名称:uk-rail-import,代码行数:9,代码来源:PromiseSFTP.ts
注:本文中的ssh2.Client类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论