pub fn upload_buffer(
bytes: &[u8],
filename: &str,
mime_type: &str,
target: Target,
) -> Result<DocumentHandle, Error>Expand description
Store bytes this action already holds.
The buffer, the name and the media type are all required, and each is checked
before anything is sent: an empty buffer, a blank name, a blank media type or
an incomplete Target is refused where it costs nothing.
use simpleplatform_sdk::storage::Target;
let handle = simple::storage::upload_buffer(
b"foobar",
"notes.txt",
"text/plain",
Target::new("dev.simple.system", "documents", "attachment"),
)?;
assert_eq!(handle.file_hash, "c3ab8ff137");