Function binary

Source
pub fn binary<S: AsRef<str>>(content: Bytes, content_type: S) -> Result
Expand description

Creates a binary response for serving binary data over HTTP.

§Parameters

  • content: A bytes::Bytes object containing the binary content.
  • content_type: An AsRef<str> (&str/String) specifying the MIME type of the content (e.g., application/pdf, image/png).

§Example

let content = bytes::Bytes::from("This is the content of the file.");

ft_sdk::data::binary(content, "text/plain").unwrap();