Crate raze[−][src]
Expand description
Raze is a library for interfacing the BackBlaze B2 API
Raze provides raw API bindings via the API along with some useful functions via utils
It is highly recommended to familiarize yourself with the official B2 documentation before using this crate
This crate exposes a blocking API by the use of reqwest
Note that despite being blocking, the same Client
can be shared by multiple threads for concurrent usage, and it is recommended to do so for uploading multiple files at once
Disclaimer: This library is not associated with Backblaze - Be aware of the B2 pricing - Refer to License.md for conditions
Example:
// Authenticate, upload and delete a file let client = reqwest::blocking::ClientBuilder::new().timeout(None).build().unwrap(); let auth = authenticate_from_file(&client, "credentials").unwrap(); let upauth = b2_get_upload_url(&client, &auth, "bucket_id").unwrap(); let file = std::fs::File::open("document.txt").unwrap(); let metadata = file.metadata().unwrap(); let size = metadata.len(); let modf = metadata.modified().unwrap() .duration_since(std::time::UNIX_EPOCH).unwrap().as_secs()*1000; let param = FileParameters { file_path: "document.txt", file_size: size, content_type: None, content_sha1: Sha1Variant::HexAtEnd, last_modified_millis: modf, }; let reader = file; let reader = ReadHashAtEnd::wrap(reader); let reader = ReadThrottled::wrap(reader, 5000); let resp1 = b2_upload_file(&client, &upauth, reader, param).unwrap(); let resp2 = b2_delete_file_version(&client, &auth, &resp1.file_name, &resp1.file_id.unwrap());
Modules
Raw API bindings, mostly 1:1 with official API
Various helper functions to assist with common tasks
Structs
An API error, returned by the B2 backend
Enums
The various kinds of errors this crate may return