Possible to 'pipe' file from one client to another?
See original GitHub issueHi,
I’m looking for a way to ‘pipe’ from one sftp client to another. I’m thinking to leverage either
this.sftpClient.fastGet(remotePath, localPath)
where remotePath
is from one client and localPath
is from another client or
this.sftpClient.fastPut(localPath, remotePath)
in a similar manner. Is this possible?
The reason for this is, in a serverless environment, I don’t want to hold the file in memory while I download from one server and upload to another.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How pass the file's content through Named Pipe and then ...
I understand how to hand over a string from the terminal to the server part of the named pipe.But, i don't have any...
Read more >Inter Process Communication - Named Pipes - Tutorialspoint
Can we use pipes for unrelated process communication, say, we want to execute client program from one terminal and the server program from...
Read more >Only one client can connect to named pipe - Stack Overflow
and a client application opening the pipe like this: using (NamedPipeClientStream pipeStream = new NamedPipeClientStream(pipeName)) { pipeStream.Connect(); // ...
Read more >Steps to save a file as a named pipe in the z/OS FTP ... - IBM
You must start an application that can read from the named pipe, and it must open the named pipe, before FTP can transfer...
Read more >how to pipe data to sftp connection? - Server Fault
i want to use the pipe command to directly redirect the file stream to sftp. (because there is not enough space left to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Theoretically, I think you could get this to work using streams. You could try using get() and put() as both of these will accept a stream object as the destination/source. The fastPut() and fastGet() methods only accept string paths as destination/source.
I’ve never tried this and suspect there will be some complexity associated with the creation of the streams and managing errors effectively. It isn’t something which fits cleanly with a promise based API, but you might be able to get it to work. On the other hand, it might be easier to implement this using just ssh2, which you have more direct access to the underlying ssh2 API. However, this would mean you need to use an event model rather than a promise based approach.
Thanks a lot. As you said, the package ssh2-sftp-client support stream, I just need to understand node’s handling of the stream.
I have tried and succeed. Thank you.