steelbrain / node-ssh

SSH2 with Promises
MIT License
947 stars 94 forks source link

LocalFile as Buffer or Text #401

Closed wasifali closed 3 years ago

wasifali commented 3 years ago

I want to upload localFile as a Buffer or a string but every time I try to do that package considers it as a path and returns error.

Is there any way to do that? If not then this is a must have.

steelbrain commented 3 years ago

Hi @wasifali!

Thank you for reaching out. This package uses the ssh2 library under the hood. Right now this is not a popular feature so it's not on the roadmap for a "convenience" API. But if you want to do this today, you can call ssh2.requestSFTP() and then call createWriteStream on the SFTP object, see the full documentation for SFTP @ https://github.com/mscdex/ssh2/blob/master/SFTP.md