I tried this but its returning 404
error, as I am working on directus extension, I can’t install npm install ssh2
:
What I needed rollup for ssh: npm install rollup-plugin-ssh2
, I have to install through rollup-plugin.
import { Client } from 'ssh2';
import fs from 'fs';
const conn = new Client();
conn.on('ready', () => {
console.log('Client :: ready');
conn.shell(async (err, stream) => {
if (err) throw err;
stream.on('close', () => {
console.log('Stream :: close');
conn.end();
});
console.log("All data processed successfully");
});
}).connect({
host: 'HOST_IP',
username: 'USERNAME',
privateKey: fs.readFileSync('/MyFile.pem')
});
rollup-plugin-ssh2 correct way