URL.Data (URL v1.3.0) View Source

Parses a data URL

Link to this section Summary

Functions

Parse a URI with the :scheme of "data"

Link to this section Types

Specs

t() :: %URL.Data{data: term(), mediatype: binary(), params: map()}

Link to this section Functions

Specs

parse(URI.t()) :: t() | {:error, {module(), binary()}}

Parse a URI with the :scheme of "data"

Example

iex> data = URI.parse "data:text/plain;base64,SGVsbG8gV29ybGQh"
iex> URL.Data.parse(data)
%URL.Data{
  data: "Hello World!",
  mediatype: "text/plain",
  params: %{"encoding" => "base64"}
}