View Source ftpfilez (ftpfilez v2.1.0)

FTPS file storage. Can put, get and stream files from FTP servers. Similar interface as s3filez.

Summary

Functions

Create a private bucket (aka directory) at the URL.

Create a bucket at the URL, with acl options.

Delete the file at the url.

Fetch the data at the url.

Put a binary or file to the given url.

Put a binary or file to the given url. Set options for acl. Ensures that the directory of the file is present by recursively creating the sub directories.

Async delete a file on S3

Async delete a file on S3, call ready_fun when ready.

Queue a named file deletion process, call ready_fun when ready.

Queue a file dowloader and call ready_fun when finished.

Queue a named file dowloader and call ready_fun when finished. Names must be unique, duplicates are refused with <tt>{error, {already_started, _}}</tt>.

Queue a file uploader. The data can be a binary or a filename.

Queue a file uploader and call ready_fun when finished.

Queue a file uploader and call ready_fun when finished. Options include the <tt>acl</tt> setting and <tt>content_type</tt> for the file.

Start a named file uploader. Names must be unique, duplicates are refused with <tt>{error, {already_started, _}}</tt>.

Queue a file downloader that will stream chunks to the given stream_fun. The default block size for the chunks is 64KB.

Queue a named file downloader that will stream chunks to the given stream_fun. The default block size for the chunks is 64KB.

Stream the contents of the url to the function, callback or Pid.

Types

acl_type/0

-type acl_type() ::
          private | public_read | public_read_write | authenticated_read | bucket_owner_read |
          bucket_owner_full_control.

config/0

-type config() :: #{username := binary(), password := binary(), tls_options => list()}.

put_data/0

-type put_data() ::
          {data, binary()} |
          {filename, pos_integer(), file:filename_all()} |
          {filename, file:filename_all()}.

put_opt/0

-type put_opt() :: {acl, acl_type()} | {content_type, string()}.

put_opts/0

-type put_opts() :: [put_opt()].

queue_reply/0

-type queue_reply() :: {ok, any(), pid()} | {error, {already_started, pid()}}.

ready_fun/0

-type ready_fun() :: undefined | {atom(), atom(), list()} | fun() | pid().

stream_fun/0

-type stream_fun() :: {atom(), atom(), list()} | fun() | pid().

sync_reply/0

-type sync_reply() :: ok | {error, enoent | forbidden | term()}.

url/0

-type url() :: binary() | string().

Functions

create_bucket(Config, Url)

-spec create_bucket(config(), url()) -> sync_reply().

Create a private bucket (aka directory) at the URL.

create_bucket(Config, Url, Opts)

-spec create_bucket(config(), url(), put_opts()) -> sync_reply().

Create a bucket at the URL, with acl options.

delete(Config, Url)

-spec delete(config(), url()) -> sync_reply().

Delete the file at the url.

get(Config, Url)

-spec get(config(), url()) ->
             {ok, ContentType :: binary(), Data :: binary()} | {error, enoent | forbidden | term()}.

Fetch the data at the url.

put(Config, Url, Payload)

-spec put(config(), url(), put_data()) -> sync_reply().

Put a binary or file to the given url.

put(Config, Url, _, Opts)

-spec put(config(), url(), put_data(), put_opts()) -> sync_reply().

Put a binary or file to the given url. Set options for acl. Ensures that the directory of the file is present by recursively creating the sub directories.

queue_delete(Config, Url)

-spec queue_delete(config(), url()) -> queue_reply().

Async delete a file on S3

queue_delete(Config, Url, ReadyFun)

-spec queue_delete(config(), url(), ready_fun()) -> queue_reply().

Async delete a file on S3, call ready_fun when ready.

queue_delete_id(JobId, Config, Url, ReadyFun)

-spec queue_delete_id(any(), config(), url(), ready_fun()) -> queue_reply().

Queue a named file deletion process, call ready_fun when ready.

queue_get(Config, Url, ReadyFun)

-spec queue_get(config(), url(), ready_fun()) -> queue_reply().

Queue a file dowloader and call ready_fun when finished.

queue_get_id(JobId, Config, Url, ReadyFun)

-spec queue_get_id(any(), config(), url(), ready_fun()) -> queue_reply().

Queue a named file dowloader and call ready_fun when finished. Names must be unique, duplicates are refused with <tt>{error, {already_started, _}}</tt>.

queue_put(Config, Url, What)

-spec queue_put(config(), url(), put_data()) -> queue_reply().

Queue a file uploader. The data can be a binary or a filename.

queue_put(Config, Url, What, ReadyFun)

-spec queue_put(config(), url(), put_data(), ready_fun()) -> queue_reply().

Queue a file uploader and call ready_fun when finished.

queue_put(Config, Url, What, ReadyFun, Opts)

-spec queue_put(config(), url(), put_data(), ready_fun(), put_opts()) -> queue_reply().

Queue a file uploader and call ready_fun when finished. Options include the <tt>acl</tt> setting and <tt>content_type</tt> for the file.

queue_put_id(JobId, Config, Url, What, ReadyFun)

-spec queue_put_id(any(), config(), url(), put_data(), ready_fun()) -> queue_reply().

Start a named file uploader. Names must be unique, duplicates are refused with <tt>{error, {already_started, _}}</tt>.

queue_stream(Config, Url, StreamFun)

-spec queue_stream(config(), url(), stream_fun()) -> queue_reply().

Queue a file downloader that will stream chunks to the given stream_fun. The default block size for the chunks is 64KB.

queue_stream_id(JobId, Config, Url, StreamFun)

-spec queue_stream_id(any(), config(), url(), stream_fun()) -> queue_reply().

Queue a named file downloader that will stream chunks to the given stream_fun. The default block size for the chunks is 64KB.

stream(Config, Url, Fun)

-spec stream(config(), url(), stream_fun() | {any(), pid()}) -> sync_reply().

Stream the contents of the url to the function, callback or Pid.