ORIONIS API REFERENCE

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.

class documentation

Represent a file received through HTTP, ready to be stored.

The object adapts the buffered multipart payload produced by the HTTP layer so it can be persisted onto any configured disk. It is fully decoupled from the request object and internally always delegates persistence to orionis.storage.File through the disk resolved by the manager.

Method __init__ Initialize the uploaded file with its payload and manager.
Async Method copy Persist the payload while keeping the upload buffer usable.
Method extension Return the lowercase file extension including the dot.
Method hashName Return a random, collision-safe name for the file.
Method mimeType Return the MIME type declared by the client.
Async Method move Persist the payload and release the upload buffer.
Method originalName Return the sanitized client-supplied file name.
Async Method read Read the full uploaded payload.
Method size Return the size of the uploaded payload in bytes.
Async Method store Persist the payload under a generated hash name.
Async Method storeAs Persist the payload under an explicit file name.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _hash_name Generated filename retained for repeated storage operations.
Instance Variable _manager Manager used to resolve target disks.
Instance Variable _source Buffered multipart payload produced by the HTTP layer.
def __init__(self, source: IHttpUploadedFile, manager: IStorageManager): (source)

Initialize the uploaded file with its payload and manager.

Parameters
source:orionis.http.payload.contracts.uploaded_file.IUploadedFileBuffered multipart payload produced by the HTTP layer.
manager:orionis.storage.contracts.IStorageManagerManager used to resolve target disks.
Returns
NoneNo return value.
async def copy(self, directory: str, name: str | None = None, disk: str | None = None) -> IFile: (source)

Persist the payload while keeping the upload buffer usable.

Parameters
directory:strRoot-relative target directory on the disk.
name:str | NoneTarget file name, or None to use a generated hash name.
disk:str | NoneDisk name, or None for the default disk.
Returns
orionis.storage.contracts.IFileFile object pointing at the stored file.
def extension(self) -> str: (source)

Return the lowercase file extension including the dot.

Returns
strExtension such as '.png', or an empty string when the original name has none.
def hashName(self) -> str: (source)

Return a random, collision-safe name for the file.

The name is generated once and cached, so repeated calls on the same instance always return the same value.

Returns
strRandom hexadecimal name with the original extension.
def mimeType(self) -> str | None: (source)

Return the MIME type declared by the client.

Returns
str | NoneDeclared MIME type, or None when absent.
async def move(self, directory: str, name: str | None = None, disk: str | None = None) -> IFile: (source)

Persist the payload and release the upload buffer.

Once closing starts, cancellation waits for the worker to finish.

Parameters
directory:strRoot-relative target directory on the disk.
name:str | NoneTarget file name, or None to use a generated hash name.
disk:str | NoneDisk name, or None for the default disk.
Returns
orionis.storage.contracts.IFileFile object pointing at the stored file.
def originalName(self) -> str: (source)

Return the sanitized client-supplied file name.

Returns
strOriginal file name as reported by the client.
async def read(self) -> bytes: (source)

Read the full uploaded payload.

Cancellation waits for the active worker before returning control.

Returns
bytesComplete payload contents.
def size(self) -> int: (source)

Return the size of the uploaded payload in bytes.

Returns
intPayload size in bytes.
async def store(self, directory: str = '', disk: str | None = None, visibility: str | None = None) -> IFile: (source)

Persist the payload under a generated hash name.

Parameters
directory:strRoot-relative target directory on the disk.
disk:str | NoneDisk name, or None for the default disk.
visibility:str | NoneVisibility to apply, or None for the medium default.
Returns
orionis.storage.contracts.IFileFile object pointing at the stored file.
async def storeAs(self, directory: str, name: str, disk: str | None = None, visibility: str | None = None) -> IFile: (source)

Persist the payload under an explicit file name.

Own and close the chunk iterator even if the destination fails. Keep the underlying upload buffer available for later reads or copies. Cancellation drains the active iterator operation before closing it.

Parameters
directory:strRoot-relative target directory on the disk.
name:strTarget file name without directory separators.
disk:str | NoneDisk name, or None for the default disk.
visibility:str | NoneVisibility to apply, or None for the medium default.
Returns
orionis.storage.contracts.IFileFile object pointing at the stored file.
Raises
orionis.storage.exceptions.StoragePathExceptionIf name is empty, a dot segment, or contains a directory separator.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

_hash_name: str | None = (source)

Generated filename retained for repeated storage operations.

_manager = (source)

Manager used to resolve target disks.

Buffered multipart payload produced by the HTTP layer.