sanketbajoria / ssh2-promise

ssh with promise/async await and typescript support
https://www.npmjs.com/package/ssh2-promise
MIT License
148 stars 24 forks source link

fastPut error #9

Closed rahbari closed 5 years ago

rahbari commented 5 years ago

I get this when usign fastPut:

node_modules\ssh2-streams\lib\sftp.js:1137
                    cb();
                    ^
TypeError: cb is not a function
    at \node_modules\ssh2-streams\lib\sftp.js:1137:21
    at \node_modules\graceful-fs\graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:139:20)
sanketbajoria commented 5 years ago

let me debug the issue. Can you please share the code snippet in meanwhile, so that i can see how you are using this function

rahbari commented 5 years ago

I used var sftp = await ssh.sftp(); instead of var sftp = new SSH2Promise.SFTP(ssh); await ssh.sftp() in docs leads to confusion.

thank for awesome work btw.

sanketbajoria commented 5 years ago

Below is sample code, how should we use it.

var ssh = new SSH2Promise(sshconfig);
var sftp = new SSH2Promise.SFTP(ssh);
await sftp.fastPut('C:\\test\\test1\\test2.log', "/home/ubuntu/test2.txt");

things should be working as expected, please let me know, if you are still facing error.

Yes, i agree, in documentation i have tried to show, how to retreive raw sftp session, which lead to confusion. I will try to update the documentation.

Thanks for your feedback

rahbari commented 5 years ago

I got it working, thank you so much.