spmjs / node-scp2

[MAINTAINER WANTED] A pure javascript scp program based on ssh2.
385 stars 96 forks source link

scp cost too much time to finish copy a directory #9

Open xiaoji121 opened 10 years ago

xiaoji121 commented 10 years ago

i want to use scp method to copy a directory to the remote host,but it cost too much time to finish it. but i use scp command directly, it cost very little time , i don't know why.

lepture commented 10 years ago

I don't know either.

mscdex commented 10 years ago

You'll get much better performance if you use sftp.fastGet() and sftp.fastPut() as they do concurrent reads/writes for you.

lepture commented 10 years ago

@mscdex A pull request is welcome

seakeys commented 2 years ago

var client = new Client({ host: config.host, username: config.username, privateKey: config.privateKey, });

client.on('transfer', function (buffer, uploaded, total) { console.log(buffer, uploaded, total, new Date()); });

scp(config.localPath, { host: config.host, username: config.username, privateKey: config.privateKey, path: config.path }, client, err => { spinner.stop(); if (!err) { console.log(chalk.green("部署完毕")) } else { console.log("err", err) } })