Crates.io | getit |
lib.rs | getit |
version | 0.1.0 |
source | src |
created_at | 2024-05-31 12:05:42.041674 |
updated_at | 2024-05-31 12:05:42.041674 |
description | An easy to use file getter for local and remote files |
homepage | https://github.com/ciresnave/getit |
repository | https://github.com/ciresnave/getit |
max_upload_size | |
id | 1257949 |
size | 11,056 |
GetIt is an easy-to-use resource getter. It is designed to be extremely minimal to the point that a simple example is all you need to learn it completely. To understand what it can do, below are a few examples of it's use.
First, add it to your Cargo.toml
:
[dependencies]
getit = "0.1"
Get a file from your computer:
let response = getit::get("file:///home/user/file.txt").unwrap();
println!("{}", response);
or, even simpler because the default scheme is file:
let response = getit::get("home/user/file.txt").unwrap();
println!("{}", response);
Get a web page via HTTP:
let response = getit::get("http://www.example.com").unwrap();
println!("{}", response);
Get a web page via HTTPS:
let response = getit::get("https://www.example.com").unwrap();
println!("{}", response);
Get remote file via FTP:
let response = getit::get("ftp://user:pass@host/file.txt").unwrap();
println!("{}", response);
ftp
feature - enabled by defaultGetIt is designed to be a simple and lightweight resource getter that can handle a variety of protocols, including file, HTTP, HTTPS, and FTP. It is intended to be easy to use and understand, with a minimal API that provides just the essential functionality.
It started as a personal project to load a configuration file either locally or from a remote server, but the author recognized that it could be useful to others as well. The goal is to provide a tool that is easy to integrate into other projects, without the overhead or mental load of a full-featured library.
GetIt is designed to be as simple as possible. It is not intended to be a full-featured HTTP client library. If you need a full-featured HTTP client library, check out ureq or reqwest. Similarly, if you need a full-featured FTP client, go find that! This is not that. This is just a simple resource getter. Nothing more.