meteoritus

Crates.iometeoritus
lib.rsmeteoritus
version0.2.1
sourcesrc
created_at2023-04-06 16:43:22.53733
updated_at2024-09-09 10:11:56.182108
descriptionA tus server integration for Rocket framework.
homepagehttps://github.com/kallebysantos/meteoritus
repositoryhttps://github.com/kallebysantos/meteoritus
max_upload_size
id832334
size421,782
Kalleby Santos (kallebysantos)

documentation

https://docs.rs/meteoritus

README

Meteoritus

CI Build and test docs.rs Crates.io Rocket Homepage

Crates.io Crates.io

A tus server integration for Rocket framework.

Getting started:

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:

Current version v0.2.0 See changelog

[dependencies]
rocket = "0.5.0-rc.2"
meteoritus = "0.2.0"

Then attach Meteoritus to your Rocket server on launch:

#[macro_use] extern crate rocket;
use rocket::data::ByteUnit;
use meteoritus::Meteoritus;

#[get("/")]
fn hello() -> &'static str {
    "Hello, world!"
}

#[launch]
fn rocket() -> _ {
let meteoritus = Meteoritus::new()
        .mount_to("/api/files")
        .with_temp_path("./tmp/uploads")
        .with_max_size(ByteUnit::Gibibyte(1))
          .on_creation(|ctx| {
                println!("on_creation: {:?}", ctx);
                Ok(())
           })
          .on_created(|ctx| {
                println!("on_created: {:?}", ctx);
           })
          .on_completed(|ctx| {
               println!("on_completed: {:?}", ctx);
           })
          .on_termination(|ctx| {
               println!("on_termination: {:?}", ctx);
           })
        .build();
    
    rocket::build()
        .attach(meteoritus)
        .mount("/", routes![hello])
}

For more detailed information check out the complete Api documentation.

Commit count: 80

cargo fmt