simpleicons 0.1.0

A Rust library for loading and querying simple-icons data from a JSON file, providing convenient access to icon metadata by name.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use reqwest::blocking;
use std::fs;
use std::path::Path;

fn main() {
    let url = "https://raw.githubusercontent.com/simple-icons/simple-icons/develop/_data/simple-icons.json";
    let out_dir = "data";
    let dest_path = Path::new(out_dir).join("simple-icons.json");

    let resp = blocking::get(url)
        .expect("Failed to download file")
        .text()
        .expect("Failed to read response text");
    fs::write(&dest_path, resp).expect("Failed to write file");
}