Expand description
§mytheclipse-storage
A unified storage & file system abstraction so file handling doesn’t get locked to one physical storage location.
- Local disk (
local::LocalFileStorage, featurelocal, default). - S3-compatible object storage ([
s3::S3Storage], features3) — works with Amazon S3 and any S3-compatible endpoint, including MinIO (pass a custom endpoint via [s3::S3Storage::connect_with_endpoint]). - Google Cloud Storage ([
gcs::GcsStorage], featuregcs).
All operations are stream-based (an traits::ObjectStream is a boxed
tokio::io::AsyncRead), so uploading/downloading a huge object never
requires holding it entirely in memory.
§Example
Local disk storage (local feature, default):
use mytheclipse_storage::{StorageDriver, bytes_stream, read_to_vec};
use mytheclipse_storage::LocalFileStorage;
let storage = LocalFileStorage::new(dir.path());
storage.put("hello.txt", bytes_stream(b"hi".to_vec())).await.unwrap();
let data = read_to_vec(storage.get("hello.txt").await.unwrap()).await.unwrap();
assert_eq!(data, b"hi");Re-exports§
pub use traits::bytes_stream;pub use traits::read_to_vec;pub use traits::ObjectMeta;pub use traits::ObjectStream;pub use traits::StorageDriver;pub use traits::StorageError;pub use local::LocalFileStorage;pub use multipart::MultipartUpload;pub use multipart::MultipartUploadDriver;pub use multipart::UploadPart;
Modules§
- local
- A local-disk
StorageDriver(featurelocal, default). - multipart
- Multipart upload trait for large-object uploads in parallel parts.
- traits
- The core
StorageDrivertrait and supporting types.