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.File through the disk resolved by the manager.

Method __init__ Initialize the uploaded file with its payload and manager.
Async Method __stream Stream the payload in chunks without loading it in memory.
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__ Undocumented
Instance Variable _hash_name Undocumented
Instance Variable _manager Undocumented
Instance Variable _source Undocumented
def __init__(self, source: IHttpUploadedFile, manager: IStorageManager): (source)

Initialize the uploaded file with its payload and manager.

Parameters
source:IHttpUploadedFileBuffered multipart payload produced by the HTTP layer.
manager:IStorageManagerManager used to resolve target disks.
Returns
NoneUndocumented
async def __stream(self) -> AsyncIterator[bytes]: (source)

Stream the payload in chunks without loading it in memory.

Yields
bytesConsecutive chunks of the buffered payload.
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
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.

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
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.

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
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.

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
IFileFile object pointing at the stored file.
Raises
StoragePathExceptionIf name is empty or contains a directory separator.
_hash_name: str | None = (source)

Undocumented

_manager = (source)

Undocumented

Undocumented