Metadata-Version: 2.4
Name: bareASGI-static
Version: 5.0.0
Summary: Static file support for bareASGI
Author-email: Rob Blackbourn <rob.blackbourn@gmail.com>
Project-URL: Homepage, https://bareASGI.github.io/bareASGI-static
Project-URL: Repository, https://github.com/bareASGI/bareASGI-static
Project-URL: Issues, https://github.com/bareASGI/bareASGI-static/issues
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiofiles<1,>=0.7
Requires-Dist: bareASGI<6,>=5.0.0-alpha.4
Provides-Extra: dev
Requires-Dist: autopep8; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-runner; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Requires-Dist: types-aiofiles; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs<2,>=1.2; extra == "docs"
Requires-Dist: mkdocs-material<8,>=7.2; extra == "docs"
Requires-Dist: jetblack-markdown<1,>=0.6; extra == "docs"
Requires-Dist: mike<2,>=1.1.1; extra == "docs"
Provides-Extra: examples
Requires-Dist: hypercorn<1,>=0.11; extra == "examples"
Requires-Dist: uvloop<1,>=0.15; extra == "examples"
Requires-Dist: uvicorn<1,>=0.15.0; extra == "examples"
Dynamic: license-file

# bareasgi-static

Static file support for [bareASGI](http://github.com/bareASGI/bareASGI) (read the [documentation](https://bareASGI.github.io/bareASGI-static/))

## Overview

This package provides support for serving static files to bareasgi.

## Usage

The following example serves a single file.

```python
import uvicorn
import os.path
from bareasgi import Application
from bareasgi_static import file_response

here = os.path.abspath(os.path.dirname(__file__))

async def http_request_callback(request):
    return await file_response(request, 200, os.path.join(here, 'file_stream.html'))

app = Application()
app.http_router.add({'GET'}, '/example1', http_request_callback)

uvicorn.run(app, port=9010)

```

The next example serves files below a given directory.

```python
import os.path
import uvicorn
from bareasgi import Application
from bareasgi_static import add_static_file_provider

here = os.path.abspath(os.path.dirname(__file__))

app = Application()
add_static_file_provider(app, os.path.join(here, simple_www), index_filename='index.html')

uvicorn.run(app, port=9010)
```
