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 UploadedFile(IUploadedFile): (source)
Constructor: UploadedFile(source, manager)
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 | hash |
Return a random, collision-safe name for the file. |
| Method | mime |
Return the MIME type declared by the client. |
| Async Method | move |
Persist the payload and release the upload buffer. |
| Method | original |
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 | store |
Persist the payload under an explicit file name. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | _hash |
Undocumented |
| Instance Variable | _manager |
Undocumented |
| Instance Variable | _source |
Undocumented |
Initialize the uploaded file with its payload and manager.
| Parameters | |
source:IHttpUploadedFile | Buffered multipart payload produced by the HTTP layer. |
manager:IStorageManager | Manager used to resolve target disks. |
| Returns | |
None | Undocumented |
Stream the payload in chunks without loading it in memory.
| Yields | |
bytes | Consecutive chunks of the buffered payload. |
str, name: str | None = None, disk: str | None = None) -> IFile:
(source)
¶
Persist the payload while keeping the upload buffer usable.
| Parameters | |
directory:str | Root-relative target directory on the disk. |
name:str | None | Target file name, or None to use a generated hash name. |
disk:str | None | Disk name, or None for the default disk. |
| Returns | |
IFile | File object pointing at the stored file. |
Return the lowercase file extension including the dot.
| Returns | |
str | Extension such as '.png', or an empty string when the original name has none. |
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 | |
str | Random hexadecimal name with the original extension. |
Return the MIME type declared by the client.
| Returns | |
str | None | Declared MIME type, or None when absent. |
str, name: str | None = None, disk: str | None = None) -> IFile:
(source)
¶
Return the sanitized client-supplied file name.
| Returns | |
str | Original file name as reported by the client. |
str = '', disk: str | None = None, visibility: str | None = None) -> IFile:
(source)
¶
str, name: str, disk: str | None = None, visibility: str | None = None) -> IFile:
(source)
¶
Persist the payload under an explicit file name.
| Parameters | |
directory:str | Root-relative target directory on the disk. |
name:str | Target file name without directory separators. |
disk:str | None | Disk name, or None for the default disk. |
visibility:str | None | Visibility to apply, or None for the medium default. |
| Returns | |
IFile | File object pointing at the stored file. |
| Raises | |
StoragePathException | If name is empty or contains a directory separator. |