SftpStage
Faster SFTP file downloader
Installation
def deps do
[
{:sftp_stage, "~> 0.1.0"}
]
endOverview
SftpStage makes use of parallel read requests to overcome the limitations of SFTP protocol. SftpStage implements GenStage.
Simple way to use SftpStage is to connect with Flow
opts = %{
host: "127.0.0.1",
port: 22,
sftp_opts: [
user: 'admin',
password: 'pass',
user_interaction: false,
silently_accept_hosts: true,
rekey_limit: 1_000_000_000_000
],
file_path: "/users/admin/reports/2019-12-01.zip"
}
Flow.from_specs([{SftpStage, opts}])
|> Stream.into(File.stream!("reports.zip"))
|> Stream.run()Since SftpStage is just a GenStage producer you can also use it with GenStage.stream or connect to your GenStage consumer.
Options
host: <kbd>required</kbd> server hostnameport: server port number. Defaults to22sftp_opts: <kbd>required</kbd> SFTP/SSH options. This keyword list is passed to Erlang library. See Erlang documentationfile_path: <kbd>required</kbd> Remote file absolute pathmax_concurrent_requests: Maximum number of allowed concurrent requests to server at a time. Defaults to10