| Crates.io | ferro-storage |
| lib.rs | ferro-storage |
| version | 0.1.71 |
| created_at | 2026-01-16 17:23:35.867356+00 |
| updated_at | 2026-01-17 20:04:54.047071+00 |
| description | File storage abstraction for the Ferro framework |
| homepage | |
| repository | https://github.com/albertogferrario/ferro |
| max_upload_size | |
| id | 2049003 |
| size | 119,845 |
File storage abstraction for the Ferro framework.
s3 feature)use ferro_storage::{Storage, DiskConfig};
// Create storage with configuration
let storage = Storage::with_config(
"local",
vec![
("local", DiskConfig::local("storage/app")),
("public", DiskConfig::local("storage/public").with_url("/storage")),
],
);
// Store a file
storage.put("documents/report.pdf", file_contents).await?;
// Get a file
let contents = storage.get("documents/report.pdf").await?;
// Check existence
if storage.exists("documents/report.pdf").await? {
println!("File exists!");
}
// Get public URL
let url = storage.disk("public")?.url("images/logo.png").await?;
// Delete a file
storage.delete("documents/old-report.pdf").await?;
// Configure multiple disks
let storage = Storage::with_config(
"local",
vec![
("local", DiskConfig::local("storage/app")),
("s3", DiskConfig::s3("my-bucket", "us-east-1")),
],
);
// Use specific disk
let s3 = storage.disk("s3")?;
s3.put("backups/data.json", data).await?;
Enable the s3 feature:
[dependencies]
ferro-storage = { version = "0.1", features = ["s3"] }
MIT