node 如何用shell进行scp传输?
发布于 8 年前 作者 yuanzhhh 6575 次浏览 来自 问答

如题,请大神支招~~~

16 回复

child_process…

@i5ting = =ssh库是啥意思

@reverland scp是基于ssh协议的,so。。。

@reverland 比如https://github.com/mscdex/ssh2

@i5ting child_process直接scp。。。

@reverland 不行的,不信你试试,哈哈

@i5ting 额。。。明天试试。。。

@i5ting 昨晚试了下这个库https://github.com/spmjs/node-scp2 成功了~

@reverland 昨晚试了下这个库https://github.com/spmjs/node-scp2 成功了~

直接用的用户名:密码@地址:路径

@yuanzhhh shipit就是这种原理

@i5ting 我这里可以

> fs.existsSync('/tmp/.zshrc');
false
> var scp = exec('scp $HOME/.zshrc reverland@localhost:/tmp/');
undefined
> fs.existsSync('/tmp/.zshrc');
true

@reverland 你这是依赖scp命令的,哈哈

@i5ting 嗯嗯,谢谢 :P

@i5ting 233就是这意思,还以为怎么回事。。。

回到顶部