5 releases
new 0.1.3 | Apr 27, 2025 |
---|---|
0.1.2 | Apr 25, 2025 |
0.1.1 | Apr 24, 2025 |
0.1.0 | Apr 24, 2025 |
0.0.0 | Apr 23, 2025 |
#429 in Rust patterns
442 downloads per month
Used in 2 crates
24KB
342 lines
Gofer.rs
Gofer.rs makes it easy to fetch data from any URL in Rust.
Just call gofer::open(url)
to get back a Read
!
✨ Features
- Currently supports
https:
,http:
,ftp:
,file:
, anddata:
URLs. - Supports opting out of any feature using comprehensive feature flags.
- Adheres to the Rust API Guidelines in its naming conventions.
- 100% free and unencumbered public domain software.
🛠️ Prerequisites
- Rust 1.81+
⬇️ Installation
Installation via Cargo
cargo add gofer
Installation in Cargo.toml
(with all features enabled)
[dependencies]
gofer = "0.1"
Installation in Cargo.toml
(with only specific features enabled)
[dependencies]
gofer = { version = "0.1", default-features = false, features = ["file"] }
👉 Examples
Importing the library
use gofer::open;
Reading HTTP(S) URLs
let result = gofer::open("https://www.google.com/robots.txt");
Reading FTP URLs
let result = gofer::open("ftp://ftp.isc.org/welcome.msg");
Reading file:
URLs
let result = gofer::open("file:///path/to/file.txt");
Reading stdin:
URLs
let result = gofer::open("stdin:");
Reading data:
URLs
let result = gofer::open("data:,Hello%2C%20world%21%0A");
📚 Reference
Protocols
Scheme | Feature | Summary |
---|---|---|
data: |
data |
Inline data in Base64 or URL-encoded format |
file: |
file |
Local file path |
ftp: |
ftp |
FTP |
http: |
http |
HTTP |
https: |
https |
HTTPS |
stdin: |
stdin |
Standard input stream |
👨💻 Development
git clone https://github.com/dryrust/gofer.rs.git
Dependencies
~3–20MB
~318K SLoC