Storage — Aquilia Documentation
Comprehensive guide and documentation for Storage in the Aquilia framework. View API reference, examples, and implementation patterns.
Unified Storage / Overview Unified Storage Subsystem Aquilia provides an async-native, unified storage abstraction that decouples your file management logic from the underlying storage providers. Configure local, in-memory, or cloud backends once, and access them anywhere. Quick Example Configure your storage integrations and interact with your files. Note that unlike legacy frameworks, you access backend instances from the registered StorageRegistry . from aquilia.storage import StorageRegistry from aquilia.storage.backends import LocalStorage, S3Storage from aquilia.storage.configs import LocalConfig, S3Config # Setup registry and backends manually (or let Workspace do it) registry = StorageRegistry() registry.register("local", LocalStorage(LocalConfig(root="./storage"))) registry.register("s3", S3Storage(S3Config(bucket="my-bucket", region="us-east-1"))) registry.set_default("local") # Save a file using the default backend (returns actual saved filename string) saved_path = await registry.default.save("docs/invoice.pdf", b"PDF_DATA") # Open a file as an async stream (returns a StorageFile wrapper) async with await registry.default.open("docs/invoice.pdf") as file: content = await file.read() # read all bytes # Save/access from a specific non-default backend await registry["s3"].save("backups/db.tar.gz", b"TAR_DATA") print(await registry["s3"].exists("backups/db.tar.gz")) Subsystem Features ))} Supported Storage Backends Backend Class Description Library Dependency ))} Architecture STORAGEREGISTRY registry.default Routes alias to backend driver LOCALSTORAGE root: "./uploads" Writes to host filesystem S3STORAGE bucket: "my-bucket" AWS S3 / R2 Cloud Object MEMORYSTORAGE backends: dict Ephemeral RAM storage SFTPSTORAGE host: "remote.com" Remote SSH Transfer )
Go to Homepage