diff options
Diffstat (limited to 'kvmd/aiotools.py')
-rw-r--r-- | kvmd/aiotools.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kvmd/aiotools.py b/kvmd/aiotools.py index a47c94c6..6183690f 100644 --- a/kvmd/aiotools.py +++ b/kvmd/aiotools.py @@ -45,6 +45,11 @@ async def read_file(path: str) -> str: return (await file.read()) +async def write_file(path: str, text: str) -> None: + async with aiofiles.open(path, "w") as file: + await file.write(text) + + # ===== def run(coro: Coroutine, final: (Coroutine | None)=None) -> None: # https://github.com/aio-libs/aiohttp/blob/a1d4dac1d/aiohttp/web.py#L515 |