# Gofer.rs
[](https://unlicense.org)
[](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0/)
[](https://crates.io/crates/gofer)
[](https://docs.rs/gofer/)
**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:`, and `data:` 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](https://rust-lang.org) 1.81+
## ⬇️ Installation
### Installation via Cargo
```bash
cargo add gofer
```
### Installation in `Cargo.toml` (with all features enabled)
```toml
[dependencies]
gofer = "0.1"
```
### Installation in `Cargo.toml` (with only specific features enabled)
```toml
[dependencies]
gofer = { version = "0.1", default-features = false, features = ["file"] }
```
## 👉 Examples
### Importing the Library
```rust
use gofer::open;
```
### Reading HTTP(S) URLs
```rust
let result = gofer::open("https://www.google.com/robots.txt");
```
### Reading FTP URLs
```rust
let result = gofer::open("ftp://ftp.isc.org/welcome.msg");
```
### Reading `file:` URLs
```rust
let result = gofer::open("file:///path/to/file.txt");
```
### Reading `stdin:` URLs
```rust
let result = gofer::open("stdin:");
```
### Reading `data:` URLs
```rust
let result = gofer::open("data:,Hello%2C%20world%21%0A");
```
## 📚 Reference
https://docs.rs/gofer/
### Protocols
`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
### Integrations
[clap] <sub>(`"clap"`)</sub> | 4.5 | [](https://docs.rs/clap/) | Implements `clap::builder::TypedValueParser` (TBD)
[miette] <sub>(`"miette"`)</sub> | 7.5 | [](https://docs.rs/miette/) | Derives `miette::Diagnostic` on `gofer::Error`
<img width="220" height="1"/> | <img width="110" height="1"/> | <img width="100" height="1"/> |
## 👨💻 Development
```bash
git clone https://github.com/dryrust/gofer.rs.git
```
---
[](https://x.com/intent/post?url=https://github.com/dryrust/gofer.rs&text=Gofer.rs)
[](https://reddit.com/submit?url=https://github.com/dryrust/gofer.rs&title=Gofer.rs)
[](https://news.ycombinator.com/submitlink?u=https://github.com/dryrust/gofer.rs&t=Gofer.rs)
[](https://www.facebook.com/sharer/sharer.php?u=https://github.com/dryrust/gofer.rs)
[](https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/dryrust/gofer.rs)
[feature flags]: https://github.com/dryrust/gofer.rs/blob/master/lib/gofer/Cargo.toml
[naming conventions]: https://rust-lang.github.io/api-guidelines/naming.html
[clap]: https://crates.io/crates/clap
[miette]: https://crates.io/crates/miette