Start of streaming shiz

This commit is contained in:
Jef Roosens 2022-04-01 14:31:09 +02:00
parent 828ee6c533
commit 910711a0f0
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
3 changed files with 26 additions and 5 deletions

View file

@ -5,9 +5,12 @@ use axum::{
routing::{get_service, post},
Router,
};
use futures_util::TryStreamExt;
use hyper::{Body, Request};
use std::io::ErrorKind;
use std::net::SocketAddr;
use tar::Archive;
use tokio_util::io::StreamReader;
use tower_http::{auth::RequireAuthorizationLayer, services::ServeDir, trace::TraceLayer};
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
@ -54,9 +57,10 @@ async fn main() {
.unwrap();
}
async fn post_deploy(body: BodyStream) {
// let tar = GzDecoder::new(body);
let tar = GzipDecoder::new(body);
let mut archive = Archive::new(tar);
archive.unpack("./static").unwrap();
async fn post_deploy(res: BodyStream) {
let mut read =
StreamReader::new(res.map_err(|axum_err| std::io::Error::new(ErrorKind::Other, axum_err)));
// let tar = GzipDecoder::new(body);
// let mut archive = Archive::new(tar);
// archive.unpack("./static").unwrap();
}