API¶
function bareasgi_static.add_static_file_provider ¶
Summary¶
Add static file support.
Parameters¶
app: ApplicationThe bareASGI application.
source_folder: strWhere to find the files to serve.
mount_point: str (optional)Where the files should appear on the url. Defaults to '/'.
check_source_folder: bool (optional)If True check the source folder exists. Defaults to True.
index_filename: Optional[str] (optional)An optional index file name. Defaults to None.
class StaticFilesProvider ¶
Summary¶
A static file provider.
Parameters¶
source_folder: strWhere to find the files to serve.
path_variable: Optional[str] (optional)A path variable to capture the mount point. Defaults to None.
check_source_folder: bool (optional)If True check the source folder exists. Defaults to True.
index_filename: Optional[str] (optional)An optional index file name. Defaults to None.
async function bareasgi_static.file_response ¶
Summary¶
A utility method to create a file response.
Parameters¶
request: HttpRequest status: intThe HTTP status code.
path: strThe path to the file.
headers: Optional[Headers] (optional)The headers. Defaults to None.
content_type: Optional[str] (optional)The content type.. Defaults to None.
filename: Optional[str] (optional)The filename. Defaults to None.
check_modified: Optional[bool] (optional)If True check for modifications to the file. Defaults to False.
async generator function bareasgi_static.file_writer ¶
Summary¶
Creates an async iterator to write a file.
Parameters¶
path: strThe path of the file to write.
chunk_size: int (optional)The size of each block. Defaults to CHUNK_SIZE.