THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
Define the contract for a single file on a storage disk.
A file object encapsulates its canonical path and delegates every operation to the driver of the disk it belongs to. It never knows which physical medium (local, memory, S3...) backs it.
| Async Method | copy |
Copy the file to target on the same disk. |
| Async Method | delete |
Delete the file from its disk. |
| Async Method | download |
Copy the file to a location on the local filesystem. |
| Async Method | exists |
Check whether the file exists on its disk. |
| Async Method | hash |
Compute the content hash of the file. |
| Async Method | info |
Collect a metadata snapshot for the file. |
| Async Method | last |
Return the last-modification timestamp of the file. |
| Async Method | mime |
Guess the MIME type of the file. |
| Async Method | move |
Move the file to target on the same disk. |
| Method | open |
Open an asynchronous binary stream over the file. |
| Method | path |
Return the canonical root-relative path of the file. |
| Async Method | read |
Read the full contents of the file. |
| Method | read |
Stream the contents of the file in chunks. |
| Async Method | rename |
Rename the file within its current directory. |
| Async Method | set |
Change the visibility of the file. |
| Async Method | size |
Return the size of the file in bytes. |
| Async Method | temporary |
Build a signed, time-limited URL for the file. |
| Async Method | url |
Build the public URL of the file. |
| Async Method | visibility |
Return the visibility of the file. |
| Async Method | write |
Write contents to the file, replacing existing data. |
| Async Method | write |
Write the chunks produced by stream to the file. |
| Class Variable | __slots__ |
Undocumented |
orionis.storage.FileDelete the file from its disk.
| Returns | |
bool | True if the file existed and was removed. |
orionis.storage.FileCopy the file to a location on the local filesystem.
| Parameters | |
destination:str | Path | Local target. When it points to an existing directory the file keeps its original name inside that directory. |
| Returns | |
Path | Absolute local path of the downloaded file. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.FileCheck whether the file exists on its disk.
| Returns | |
bool | True if the file exists. |
orionis.storage.FileCompute the content hash of the file.
| Parameters | |
algorithm:str | Any algorithm name accepted by hashlib.new. |
| Returns | |
str | Hexadecimal digest of the file contents. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.FileCollect a metadata snapshot for the file.
| Returns | |
FileInfo | Immutable entity with size, MIME type, timestamps, hashes, visibility, and URL when available. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.FileReturn the last-modification timestamp of the file.
| Returns | |
datetime | Timezone-aware modification timestamp (UTC). |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.FileGuess the MIME type of the file.
| Returns | |
str | None | MIME type, or None when it cannot be determined. |
orionis.storage.FileOpen an asynchronous binary stream over the file.
| Parameters | |
mode:str | Binary mode: 'rb', 'wb', 'ab', 'rb+', 'wb+', or 'ab+'. |
| Returns | |
IStorageStream | Lazily opened stream; use it as an async context manager. |
orionis.storage.FileReturn the canonical root-relative path of the file.
| Returns | |
str | Normalized path relative to the disk root. |
orionis.storage.FileRead the full contents of the file.
| Returns | |
bytes | Complete file contents. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.FileRename the file within its current directory.
| Parameters | |
name:str | New file name without any directory separator. |
| Returns | |
IFile | A new file object pointing at the renamed file. |
| Raises | |
StoragePathException | If name is empty or contains a directory separator. |
StorageFileNotFoundException | If the source file does not exist. |
orionis.storage.FileReturn the size of the file in bytes.
| Returns | |
int | File size in bytes. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.FileBuild the public URL of the file.
| Returns | |
str | Publicly accessible URL. |
| Raises | |
UnsupportedStorageOperationException | If the disk does not expose public URLs. |
orionis.storage.FileReturn the visibility of the file.
| Returns | |
str | 'public' or 'private'. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
bytes | str, visibility: str | None = None) -> IFile:
(source)
¶
orionis.storage.FileWrite contents to the file, replacing existing data.
| Parameters | |
contents:bytes | str | Data to persist. Strings are encoded as UTF-8. |
visibility:str | None | Visibility to apply, or None for the medium default. |
| Returns | |
IFile | The file itself, enabling fluent chaining. |