sftp_ex v0.1.0 SftpEx
Library to transfer files through SFTP
Summary
Functions
Download a file given the host, remote_path, and options
Creates an SFTP stream by opening an SFTP connection and opening a file in read or write mode
Uploads a file via SFTP
Functions
Creates an SFTP stream by opening an SFTP connection and opening a file in read or write mode.
Below is an example of reading a file from a server.
An example of writing a file to a server is the following.
stream = File.stream!(“filename.txt”)
|> Stream.into(SftpEx.stream!("server01","/home/path/filename.txt",[]))
|> Stream.run
This follows the same pattern as Elixir IO streams so a file can be transferred from one server to another via SFTP as follows.
stream = SftpEx.stream!(“server01”,”/home/path/filename.txt”, []) |> Stream.into(SftpEx.stream!(“server02”,”/home/path/filename.txt”, [])) |> Stream.run