8000 GitHub - Pascal736/favilib: Favicon Fetcher written in Rust. Contains library as well as CLI tool
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Pascal736/favilib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crates.io version docs.rs

favilib

Favicon Fetcher written in Rust. Contains library as well as CLI tool.

Warning

This is a work in progress. The library is not yet stable.

Library

use favilib::{fetch, Favicon, ImageSize, ImageFormat, Url, Client};

let url = Url::parse("https://github.com").unwrap();

// Fetch and export image directly
let _ = fetch(&url, ImageSize::Large, ImageFormat::Png, "favicon.png", None);

// Fetch image and get it as a struct
let client = Client::new(); 
let favicon = Favicon::fetch(&url, Some(client)).unwrap();

let resized_favicon = favicon.resize(ImageSize::Custom(32,32)).unwrap();
let reformatted_favicon = resized_favicon.change_format(ImageFormat::Png).unwrap();
reformatted_favicon.export("favicon.png").unwrap();

CLI

Installation

CLI can be installed via cargo by running cargo install favilib

Interface

# Format will be changed based on the file ending
favilib fetch github.com --size large --path favicon.png 

# Format can also be specified explicitly and bytes can be printed to stdout. Size can be specified explicitly
favilib fetch github.com --size 32,32 --format ico --stdout

# Prints the extracted URL of the favicon to stdout
favilib fetch github.com --url-only --stdout

About

Favicon Fetcher written in Rust. Contains library as well as CLI tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0