pub fn put<B, FN, A, O>(
bucket_id: B,
file_name: FN,
properties: A,
contents: O
) -> Result<StorageResponse, StorageError>where
B: AsRef<str>,
FN: AsRef<str>,
A: AsRef<str>,
O: AsRef<[u8]>,
Expand description
Uploads a file to the EDJX Object Store.
Example
let file_name = "example.txt";
let bucket_id = "af66ad83-e55b-4a71-a7d5-6ec3199e42e9";
let buf_data = b"Sample data for upload";
let properties = "Cache-Control=true,Type=text";
let put_res: StorageResponse = match storage::put(&bucket_id, &file_name, &properties , &buf_data.as_ref()) {
Ok(r) => r,
Err(e) => {
return HttpResponse::from(e.to_string().as_str().to_owned())
.set_status(e.to_http_status_code())
}
};