upload_file#
- class starlite.datastructures.upload_file.UploadFile#
Bases:
object
Representation of a file upload, modifying the pydantic schema.
- __init__(content_type: str, filename: str, file_data: Optional[bytes] = None, headers: Optional[Dict[str, str]] = None, max_spool_size: int = 1048576) None #
Upload file in-memory container.
- Parameters:
content_type – Content type for the file.
filename – The filename.
file_data – File data.
headers – Any attached headers.
max_spool_size – The size above which the temporary file will be rolled to disk.
- property rolled_to_disk: bool#
Determine whether the spooled file exceeded the rolled-to-disk threshold and is no longer in memory.
- Returns:
A boolean flag
- async write(data: bytes) int #
Proxy for data writing.
- Parameters:
data – Byte string to write.
- Returns:
None
- async read(size: int = -1) bytes #
Proxy for data reading.
- Parameters:
size – position from which to read.
- Returns:
Byte string.