fey 0.0.1

fey is a fast and reliable username scanner
Documentation
use std::path::PathBuf;
use std::fs;
use crate::utils::error::Error;

pub async fn get_data_file<'a>(fey_config_dir_path: PathBuf) -> Result<(), Error>{

// TODO: proper error handling
    // get the urls.txt file
    let urls_file_contents = reqwest::get("https://raw.githubusercontent.com/falkwitte/fey/main/src/urls.txt").await
        .unwrap()
        .text()
        .await
        .unwrap();


// we can use dirs::config_dir here because above while creating the config file, we evaluated that the config dir exists
    match fs::write(fey_config_dir_path.join("urls.txt"), urls_file_contents){
        Ok(()) => Ok(()),
        Err(error) => {
            let errormsg = format!("could not create data file {}", error);
            Err(Error::FatalError(errormsg))
        }
    }
}