View Source webdavfilez (webdavfilez v2.0.0)
WebDAV file storage. Can put, get and stream files. Uses a job queue which is regulated by "jobs".
Summary
Functions
Create a directory (bucket) at the URL.
Create a directory (bucket) at the URL, ignore 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 and/or content_type.
Async delete a file on WebDAV
Async delete a file on WebDAV, 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.
Types
-type acl_type() ::
private | public_read | public_read_write | authenticated_read | bucket_owner_read |
bucket_owner_full_control.
-type http_code() :: 100..600.
-type put_data() :: {data, binary()} | {filename, non_neg_integer(), file:filename_all()} | {filename, file:filename_all()}.
-type put_opts() :: [put_opt()].
-type sync_reply() :: ok | {error, enoent | forbidden | http_code()}.
Functions
-spec create_bucket(config(), url()) -> sync_reply().
Create a directory (bucket) at the URL.
-spec create_bucket(config(), url(), put_opts()) -> sync_reply().
Create a directory (bucket) at the URL, ignore acl options.
-spec delete(config(), url()) -> sync_reply().
Delete the file at the url.
-spec get(config(), url()) -> {ok, ContentType :: binary(), Data :: binary()} | {error, enoent | forbidden | http_code()}.
Fetch the data at the url.
-spec put(config(), url(), put_data()) -> sync_reply().
Put a binary or file to the given url.
-spec put(config(), url(), put_data(), put_opts()) -> sync_reply().
Put a binary or file to the given url. Set options for acl and/or content_type.
-spec queue_delete(config(), url()) -> queue_reply().
Async delete a file on WebDAV
-spec queue_delete(config(), url(), ready_fun()) -> queue_reply().
Async delete a file on WebDAV, call ready_fun when ready.
-spec queue_delete_id(any(), config(), url(), ready_fun()) -> queue_reply().
Queue a named file deletion process, call ready_fun when ready.
-spec queue_get(config(), url(), ready_fun()) -> queue_reply().
Queue a file dowloader and call ready_fun when finished.
-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>.
-spec queue_put(config(), url(), put_data()) -> queue_reply().
Queue a file uploader. The data can be a binary or a filename.
-spec queue_put(config(), url(), put_data(), ready_fun()) -> queue_reply().
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>.
-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.
-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.
-spec stream(config(), url(), stream_fun()) -> sync_reply().