2.0.0 • Published 8 months ago
@trans.js/node-ssh-client v2.0.0
@trans.js/node-ssh-client
对ssh2
的重新打包
ssh2
依赖一些node模块,本项目在linux x86-64
系统下打包发布。
node-gyp 是一个 Node.js 模块,用于编译 Node.js C++ 插件。它提供了一个命令行工具,可以编译 C++ 代码并将其编译为 Node.js 模块。
示例
const { default: SSH } = require('@trans.js/node-ssh-client');
import SSH from '@trans.js/node-ssh-client'
import minimist from 'minimist';
const args = minimist(process.argv.slice(2))
const filepath = args['privateKeyPath']// --privateKeyPath
const connConfig = {
host: 'ip',
port: 22,
username: 'user',
privateKey: readFileSync('filepath'),
};
const ssh = new SSH();
await ssh.open(connConfig);
await ssh.exec('uptime');
安装
pnpm i @trans.js/node-ssh-client
# 或者
yarn add @trans.js/node-ssh-client