FileService#
- class FileService[source]#
- download(*, filename, mime=Nothing, as_attachment=False, name=Nothing, extra_parameters=None)[source]#
Serve some specific file in the uploads folder.
Warning: The file will be deleted after you download it!
- Parameters:
filename (
str
) – The filename of the file to get.mime (
Union
[Just
[str
],_Nothing
[str
]]) – The mime type header to set on the response.as_attachment (
bool
) – If truthy the response will have a Content-Disposition: attachment header set.name (
Union
[Just
[str
],_Nothing
[str
]]) – The filename for the attachment, defaults to the second part of the url.extra_parameters (
Optional
[Mapping
[str
,Union
[str
,bool
,int
,float
]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.
- Returns:
The requested file.
- Return type:
- upload(*, max_age=Nothing, filename='uploaded_file', ephemeral=False, extra_parameters=None)[source]#
Temporarily store some data on the server.
- Parameters:
max_age (
Union
[Just
[int
],_Nothing
[int
]]) – The maximum amount of time (in seconds) this file will stay valid and can be retrieved.filename (
str
) – The name of the uploaded file.ephemeral (
bool
) – If set this file will be never saved to persistent storage. The maximum size of file that can be uploaded like this is 1mb.extra_parameters (
Optional
[Mapping
[str
,Union
[str
,bool
,int
,float
]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.self (FileService[AuthenticatedClient]) –
- Returns:
The data for the file you can download on our server.
- Return type: