this repo has no description
at main 441 B view raw
1use std::{fs::File, io::Write, path::PathBuf}; 2 3use flate2::{write::GzEncoder, Compression}; 4use tauri::State; 5 6use crate::utils::config::Config; 7 8#[tauri::command] 9pub fn save_graph(graph: String, path: PathBuf, conf: State<Config>) { 10 let file = File::create(&path).unwrap(); 11 let mut encoder = GzEncoder::new(file, Compression::default()); 12 13 encoder.write_all(graph.as_bytes()).unwrap(); 14 encoder.finish().unwrap(); 15 16 conf.save(); 17}