SftpStage

Faster SFTP file downloader

Installation

def deps do
  [
    {:sftp_stage, "~> 0.1.0"}
  ]
end

Overview

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