CNode

node 如何用shell进行scp传输?

问答
Yyuanzhhh发布于11 年前最后回复10 年前16 回复7638 浏览0 收藏

如题,请大神支招~~~

查看回复

回复 (16)

R
reverland#1·11 年前

child_process...

I
i5ting#2·11 年前
引用 reverlandchild\ process...

@reverland 需要ssh库的

R
reverland#3·11 年前
引用 i5ting@reverland 需要ssh库的

@i5ting = =ssh库是啥意思

I
i5ting#4·11 年前
引用 reverland@i5ting = =ssh库是啥意思

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

R
reverland#6·11 年前
引用 i5ting@reverland 比如https://github.com/mscdex/ssh2

@i5ting child_process直接scp。。。

I
i5ting#7·11 年前
引用 reverland@i5ting child\ process直接scp。。。

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

R
reverland#8·11 年前
引用 i5ting@reverland 不行的,不信你试试,哈哈

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

Y
yuanzhhh#9·11 年前
引用 i5ting@reverland 需要ssh库的

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

Y
yuanzhhh#10·11 年前
Y
yuanzhhh#11·11 年前

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

R
reverland#13·11 年前
引用 i5ting@reverland 不行的,不信你试试,哈哈

@i5ting 我这里可以

> fs.existsSync('/tmp/.zshrc');
false
> var scp = exec('scp $HOME/.zshrc reverland@localhost:/tmp/');
undefined
> fs.existsSync('/tmp/.zshrc');
true
I
i5ting#14·11 年前
引用 reverland@i5ting 我这里可以

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

Y
yuanzhhh#15·10 年前
引用 i5ting@yuanzhhh shipit就是这种原理

@i5ting 嗯嗯,谢谢 :P

R
reverland#16·10 年前
引用 i5ting@reverland 你这是依赖scp命令的,哈哈

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

参与回复
登录后即可参与回复。登录