Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1018 Bytes

File metadata and controls

39 lines (29 loc) · 1018 Bytes

tus-rs

Rust implementation of TUS protocol for resumable uploads.

Heavily influenced by:

Usage

Create a resource

let path = PathBuf::from_str("/path/to/file")?;
let client = Client::new();
let host = Url::parse(TUS_ENDPOINT).unwrap();
let upload_metadata = client.create(&path, &host, None, None).await?;

Resume the upload

let client = Client::new();
let host = Url::parse(TUS_ENDPOINT).unwrap();
let upload_metadata = // get metadata from the `create` function, or disk/memory
let upload_metadata = client.resume(&upload_metadata).await?;

Create and upload a file same time

let path = PathBuf::from_str("/path/to/file")?;
let client = Client::new();
let host = Url::parse(TUS_ENDPOINT).unwrap();
let extra_metadata = Some(HashMap::<String,String>::new());
let custom_headers = None;
let result = client.upload(&path, &host, extra_metadata, custom_headers).await;