Hi i try to use this third library ssh2 to connect to sftp.
npm install @types/ssh2
typings instal
ionic info:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.8.1
ionic start proyect in class home :
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
//import * as ssh2 from 'ssh2';
declare var inspect: any;
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController) {
var Client = require('ssh2').Client;
var conn = new Client();
conn.on('ready', function () {
console.log('Client :: ready');
conn.exec('uptime', function (err, stream) {
if (err) throw err;
stream.on('close', function (code, signal) {
console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
conn.end();
}).on('data', function (data) {
console.log('STDOUT: ' + data);
}).stderr.on('data', function (data) {
console.log('STDERR: ' + data);
});
});
}).connect({
host: '-',
port: 22,
username: '-',
password: '-',
readyTimeout: 1000
});
}
}
I get cannot find module error always, I try import * as ssh2 from ‘ssh2’ and others things.
Its my first question here Im a new ionic2 developer , thanks!