Meteoritus is a Fairing
that implements tus protocol on top of Rocket
framework, so in order to use it you'll need the following dependencies in Cargo.toml
:
toml
[dependencies]
rocket = "0.5.0-rc.2"
meteoritus = "0.1.0"
Then attach Meteoritus
to your Rocket
server on launch:
```rust
use rocket::data::ByteUnit; use meteoritus::Meteoritus;
fn hello() -> &'static str { "Hello, world!" }
fn rocket() -> _ { let meteoritus = Meteoritus::new() .mountto("/api/files") .withtemppath("./tmp/uploads") .withmaxsize(ByteUnit::Gibibyte(1)) .oncreation(|ctx| { println!("oncreation: {:?}", ctx); Ok(()) }) .oncreated(|ctx| { println!("oncreated: {:?}", ctx); }) .oncompleted(|ctx| { println!("on_completed: {:?}", ctx); }) .build(); rocket::build() .attach(meteoritus) .mount("/", routes![hello]) } ```
For more detailed information check out the complete Api documentation.