> Every page of the ganymede website is listed in https://eugo.io/docs/ganymede/llms.txt.

# Aiofile

> Aiofile: Real asynchronous file operations with asyncio support. A Python demo notebook from ganymede.

Web page: https://eugo.io/docs/ganymede/demo_notebooks/data_storage/filesystems/aiofile/
Notebook: https://eugo.io/docs/ganymede/demo_notebooks/data_storage/filesystems/aiofile/aiofile.ipynb (source: https://github.com/eugo-inc/ganymede/blob/main/demo_notebooks/data_storage/filesystems/aiofile.ipynb)

Description:
- Real asynchronous file operations with asyncio support.

Resources:
- [GitHub] https://github.com/mosquito/aiofile

## Example 1

Create a new file asynchronously and write to it

```python
import asyncio
from pathlib import Path
from tempfile import gettempdir

from aiofile import async_open

tmp_filename = Path(gettempdir()) / "hello.txt"

async def main():
    async with async_open(tmp_filename, 'w+') as afp:
        await afp.write("Hello ")
        await afp.write("world")
        afp.seek(0)

        print(await afp.read())

        await afp.write("Hello from\nasync world")
        print(await afp.readline())
        print(await afp.readline())

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
```
