Crate elif_storage

Source
Expand description

§elif-storage

A comprehensive multi-backend file storage system for the elif.rs framework.

§Features

  • Multi-backend support: Local filesystem, AWS S3, and Google Cloud Storage
  • File upload validation: Size, type, and content validation
  • Image processing: Resize, crop, optimize, and watermark images
  • CDN integration: Signed URLs and CDN support
  • Access control: File permissions and access control
  • Temporary file management: Automatic cleanup of temporary files
  • Streaming support: Handle large files efficiently
  • Async-first: Built for modern async Rust applications

§Quick Start

use elif_storage::{Storage, LocalBackend, LocalStorageConfig};
 
// Create a local filesystem storage
let config = LocalStorageConfig::default().with_root_path("./storage");
let storage = Storage::new(LocalBackend::new(config));
 
// Store a file
let file_data = b"Hello, World!";
let file_info = storage.put("documents/hello.txt", file_data, None).await.unwrap();
 
// Retrieve a file
let retrieved = storage.get("documents/hello.txt").await.unwrap();
assert_eq!(retrieved.unwrap().as_ref(), file_data);

Re-exports§

pub use backends::*;
pub use config::*;
pub use upload::*;
pub use validation::*;
pub use permissions::*;
pub use cleanup::*;

Modules§

backends
Storage backend implementations
cleanup
Temporary file cleanup system
config
Storage configuration
permissions
File access control and permissions
upload
File upload utilities
validation
File validation utilities

Structs§

FileMetadata
File metadata
Storage
High-level storage interface with additional features
StorageStats
Storage statistics
UploadOptions
File upload options

Enums§

StorageError
Storage operation errors

Traits§

StorageBackend
Core storage backend trait that all storage implementations must implement

Type Aliases§

FilePath
File path type
StorageResult
Result type for storage operations