nv-cli-ssh
v1.0.6
Published
nv-cli-ssh ======================= - ssh client for cli-tools - currently only cd , pwd, ls support result format - other output/rslt formatter exist in nv-shell-parser
Downloads
123
Readme
nv-cli-ssh
- ssh client for cli-tools
- currently only cd , pwd, ls support result format
- other output/rslt formatter exist in nv-shell-parser
install
- npm install nv-cli-ssh
splitted
usage
const x = require("nv-cli-ssh");example
login
var r = await x.login_with_name_and_passwd("aaa.bbb.com","the-username","the-password")cd
await r.cd("/upload");
r.pwd() ; // /upload ls
var rslt = await r.ls();
> rslt.detail.length
183
> rslt.brief
{ total: 9035488 }
> rslt.detail[0]
{
type: 'dir',
permission: {
user: { read: true, write: true, exec: true },
group: { read: true, write: false, exec: true },
others: { read: true, write: false, exec: true }
},
hard_link_cnt: 7,
owner: 'root',
group: 'root',
bytsz: 12288,
date: 2001-01-07T12:15:00.000Z,
path: '/upload'
}
>
> rslt.detail[182]
{
type: 'file',
permission: {
user: { read: true, write: true, exec: false },
group: { read: true, write: false, exec: false },
others: { read: true, write: false, exec: false }
},
hard_link_cnt: 1,
owner: 'root',
group: 'root',
bytsz: 252,
date: 2022-06-24T00:00:00.000Z,
path: '/upload/bakup.xz'
}
> METHODS
async fetch(cmd, input_fmt=(r)=>r, output_fmt=(r)=>r) // exec shell cmd
async dnload(src/*remote-server-file-path*/, dst/*string OR writeStream*/,max_buf_sz=8192,overwite_dst=true)
async upload(src/*string OR readStream*/, dst/*remote-server-file-path*/,overwite_dst=true)
astat_abs_path(abs_path)
aread_abs_dir_path(abs_dir_path)
aopen_abs_file_path(abs_file_path,flags="r")
r._ainit r._arecv r._asend r._fetch r._quit
r.c_ r.streams_APIS
{
creat: [AsyncFunction: creat],
login_with_name_and_passwd: [AsyncFunction: login_with_name_and_passwd]
}LICENSE
- ISC
