Module webdavfilez

WebDAV file storage.

Copyright © 2022 Marc Worrell

Authors: Marc Worrell.

Description

WebDAV file storage. Can put, get and stream files. Uses a job queue which is regulated by "jobs".

Data Types

acl_type()

acl_type() = private | public_read | public_read_write | authenticated_read | bucket_owner_read | bucket_owner_full_control

config()

config() = {Username::binary() | string(), Password::binary() | string()}

http_code()

http_code() = 100..600

put_data()

put_data() = {data, binary()} | {filename, non_neg_integer(), file:filename_all()} | {filename, file:filename_all()}

put_opt()

put_opt() = {acl, acl_type()} | {content_type, string()}

put_opts()

put_opts() = [put_opt()]

queue_reply()

queue_reply() = {ok, any(), pid()} | {error, {already_started, pid()}}

ready_fun()

ready_fun() = undefined | {atom(), atom(), list()} | function() | pid()

stream_fun()

stream_fun() = {atom(), atom(), list()} | function() | pid()

sync_reply()

sync_reply() = ok | {error, enoent | forbidden | http_code()}

url()

url() = binary() | string()

Function Index

create_bucket/2Create a directory (bucket) at the URL.
create_bucket/3Create a directory (bucket) at the URL, ignore acl options.
delete/2Delete the file at the url.
get/2Fetch the data at the url.
put/3Put a binary or file to the given url.
put/4Put a binary or file to the given url.
put_body_file/1
queue_delete/2Async delete a file on WebDAV.
queue_delete/3Async delete a file on WebDAV, call ready_fun when ready.
queue_delete_id/4Queue a named file deletion process, call ready_fun when ready.
queue_get/3Queue a file dowloader and call ready_fun when finished.
queue_get_id/4Queue a named file dowloader and call ready_fun when finished.
queue_put/3Queue a file uploader.
queue_put/4Queue a file uploader and call ready_fun when finished.
queue_put/5Queue a file uploader and call ready_fun when finished.
queue_put_id/5Start a named file uploader.
queue_stream/3Queue a file downloader that will stream chunks to the given stream_fun.
queue_stream_id/4Queue a named file downloader that will stream chunks to the given stream_fun.
stream/3

Function Details

create_bucket/2

create_bucket(Config::config(), Url::url()) -> sync_reply()

Create a directory (bucket) at the URL.

create_bucket/3

create_bucket(Config::config(), Url::url(), Opts::put_opts()) -> sync_reply()

Create a directory (bucket) at the URL, ignore acl options.

delete/2

delete(Config::config(), Url::url()) -> sync_reply()

Delete the file at the url.

get/2

get(Config::config(), Url::url()) -> {ok, ContentType::binary(), Data::binary()} | {error, enoent | forbidden | http_code()}

Fetch the data at the url.

put/3

put(Config::config(), Url::url(), Payload::put_data()) -> sync_reply()

Put a binary or file to the given url.

put/4

put(Config::config(), Url::url(), X3::put_data(), Opts::put_opts()) -> sync_reply()

Put a binary or file to the given url. Set options for acl and/or content_type.

put_body_file/1

put_body_file(X1) -> any()

queue_delete/2

queue_delete(Config::config(), Url::url()) -> queue_reply()

Async delete a file on WebDAV

queue_delete/3

queue_delete(Config::config(), Url::url(), ReadyFun::ready_fun()) -> queue_reply()

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

queue_delete_id/4

queue_delete_id(JobId::any(), Config::config(), Url::url(), ReadyFun::ready_fun()) -> queue_reply()

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

queue_get/3

queue_get(Config::config(), Url::url(), ReadyFun::ready_fun()) -> queue_reply()

Queue a file dowloader and call ready_fun when finished.

queue_get_id/4

queue_get_id(JobId::any(), Config::config(), Url::url(), ReadyFun::ready_fun()) -> queue_reply()

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

queue_put/3

queue_put(Config::config(), Url::url(), What::put_data()) -> queue_reply()

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

queue_put/4

queue_put(Config::config(), Url::url(), What::put_data(), ReadyFun::ready_fun()) -> queue_reply()

Queue a file uploader and call ready_fun when finished.

queue_put/5

queue_put(Config::config(), Url::url(), What::put_data(), ReadyFun::ready_fun(), Opts::put_opts()) -> queue_reply()

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

queue_put_id/5

queue_put_id(JobId::any(), Config::config(), Url::url(), What::put_data(), ReadyFun::ready_fun()) -> queue_reply()

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

queue_stream/3

queue_stream(Config::config(), Url::url(), StreamFun::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/4

queue_stream_id(JobId::any(), Config::config(), Url::url(), StreamFun::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/3

stream(Config::config(), Url::url(), Fun::stream_fun()) -> sync_reply()


Generated by EDoc