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.
Represent a single file on a storage disk.
The object encapsulates its canonical path and the driver of the disk it belongs to. It never knows which physical medium backs it: every operation is delegated to the driver.
| Method | __init__ |
Initialize the file with its driver and canonical path. |
| 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 |
| Instance Variable | _driver |
Undocumented |
| Instance Variable | _path |
Undocumented |
Initialize the file with its driver and canonical path.
| Parameters | |
driver:IStorageDriver | Driver of the disk that owns the file. |
path:str | Root-relative file path; normalized on ingestion. |
| Returns | |
None | Undocumented |
| Raises | |
StoragePathException | If path is invalid or resolves to the disk root. |
orionis.storage.contracts.IFile.deleteDelete the file from its disk.
| Returns | |
bool | True if the file existed and was removed. |
orionis.storage.contracts.IFile.downloadCopy 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.contracts.IFile.existsCheck whether the file exists on its disk.
| Returns | |
bool | True if the file exists. |
orionis.storage.contracts.IFile.hashCompute 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.contracts.IFile.infoCollect 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. |
Return the last-modification timestamp of the file.
| Returns | |
datetime | Timezone-aware modification timestamp (UTC). |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.contracts.IFile.mimeTypeGuess the MIME type of the file.
| Returns | |
str | None | MIME type, or None when it cannot be determined. |
orionis.storage.contracts.IFile.moveToMove the file to target on the same disk.
The current object keeps pointing at the old path; use the returned object to keep working with the moved file.
| Parameters | |
target:str | Root-relative destination path. |
| Returns | |
IFile | A new file object pointing at the moved file. |
| Raises | |
StorageFileNotFoundException | If the source file does not exist. |
orionis.storage.contracts.IFile.openOpen 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. |
| Raises | |
UnsupportedStorageOperationException | If mode is not a supported binary mode. |
orionis.storage.contracts.IFile.pathReturn the canonical root-relative path of the file.
| Returns | |
str | Normalized path relative to the disk root. |
orionis.storage.contracts.IFile.readRead the full contents of the file.
| Returns | |
bytes | Complete file contents. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.contracts.IFile.renameRename 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.contracts.IFile.sizeReturn the size of the file in bytes.
| Returns | |
int | File size in bytes. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.contracts.IFile.urlBuild the public URL of the file.
| Returns | |
str | Publicly accessible URL. |
| Raises | |
UnsupportedStorageOperationException | If the disk does not expose public URLs. |
Return the visibility of the file.
| Returns | |
str | 'public' or 'private'. |
| Raises | |
StorageFileNotFoundException | If the file does not exist. |
orionis.storage.contracts.IFile.writeWrite 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. |
AsyncIterable[ bytes], visibility: str | None = None) -> IFile:
(source)
¶