Azurex.Blob (AzureX v0.1.4) View Source
Implementation of Azure Blob Storage.
In the functions below set container as nil to use the one configured in Azurex.Blob.Config
.
Link to this section Summary
Functions
Download a blob
Returns the url for a container (defaults to the one in Azurex.Blob.Config
)
Returns the url for a file in a container (defaults to the one in Azurex.Blob.Config
)
Lists all blobs in a container
Link to this section Functions
Download a blob
Examples
iex> get_blob("filename.txt")
{:ok, "file contents"}
iex> get_blob("filename.txt", "container")
{:ok, "file contents"}
iex> get_blob("filename.txt", nil, timeout: 10)
{:ok, "file contents"}
iex> get_blob("filename.txt")
{:error, %HTTPoison.Response{}}
Specs
get_url(optional_string()) :: String.t()
Returns the url for a container (defaults to the one in Azurex.Blob.Config
)
Specs
Returns the url for a file in a container (defaults to the one in Azurex.Blob.Config
)
Lists all blobs in a container
Examples
iex> Azurex.Blob.list_blobs()
{:ok, "<?xml ...."}
iex> Azurex.Blob.list_blobs()
{:error, %HTTPoison.Response{}}
Link to this function
put_blob(name, blob, content_type, container \\ nil, params \\ [])
View SourceSpecs
put_blob(String.t(), binary(), String.t(), optional_string(), keyword()) :: :ok | {:error, HTTPoison.AsyncResponse.t() | HTTPoison.Error.t() | HTTPoison.Response.t()}
Upload a blob.
Examples
iex> put_blob("filename.txt", "file contents", "text/plain")
:ok
iex> put_blob("filename.txt", "file contents", "text/plain", "container")
:ok
iex> put_blob("filename.txt", "file contents", "text/plain", nil, timeout: 10)
:ok
iex> put_blob("filename.txt", "file contents", "text/plain")
{:error, %HTTPoison.Response{}}