Polyjuice Client v0.4.4 Polyjuice.Client.Media View Source
Media-related functions.
Link to this section Summary
Link to this section Functions
Download a file from the media repository.
url may be either a binary or a URI (giving an mxc:// URI to download),
or a {server_name, media_id} tuple. filename is an (optional) filename to
request that the server use, and allow_remote indicates whether the server
should fetch media from remote servers if necessary (defaults to true).
If successful, returns a tuple of the form {:ok, filename, content_type, body},
where body is a Stream such that Enum.join(body) is the file contents.
Upload a file to the media repository.
data may be either a binary, indicating the file contents, or a tuple
{:file, path}, where path is a path to the file to be uploaded.
opts is a keyword list of options. Recognized options are:
filename:the filename to use for the uploaded file. This is required whendatais a binary. If not specified, anddatais of the form{:file, path}, then the filename defaults to the basename of the path.mimetype:the mimetype to use for the uploaded file. Defaults toapplication/octet-stream.