View Source ftpfilez_ftps (ftpfilez v2.1.0)

Place a data file on a FTP(S) server, list home directory, or fetch a file. The fetched file can be streamed.

Summary

Types

config/0

-type config() ::
          #{host := string() | binary(),
            port => pos_integer(),
            username => string() | binary(),
            password => string() | binary(),
            tls_options => list()}.

Functions

delete(Config, Filename)

-spec delete(Config, Filename) -> Result
                when Config :: config(), Filename :: binary() | string(), Result :: ok | {error, term()}.

download(Config, Filename)

-spec download(Config, Filename) -> Result
                  when
                      Config :: config(),
                      Filename :: binary() | string(),
                      Result :: {ok, binary()} | {error, term()}.

list(Config)

-spec list(Config) -> Result when Config :: config(), Result :: {ok, [binary()]} | {error, term()}.

mkdir(Config, Directory)

-spec mkdir(Config, Directory) -> Result
               when Config :: config(), Directory :: binary() | string(), Result :: ok | {error, term()}.

stream(Config, Filename, StreamFun)

-spec stream(Config, Filename, StreamFun) -> Result
                when
                    Config :: config(),
                    Filename :: binary() | string(),
                    StreamFun :: ftpfilez:stream_fun() | {any(), pid()},
                    Result :: ok | {error, term()}.

upload(Config, Filename, Data)

-spec upload(Config, Filename, Data) -> Result
                when
                    Config :: config(),
                    Filename :: binary() | string(),
                    Data :: binary() | {file, file:filename_all()},
                    Result :: ok | {error, term()}.

vsftpd_tls(Host, Cfg)