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

# AsyncLocal

> AsyncLocal: Work with your local filesystem asynchronously. A Python demo notebook from ganymede.

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

Description:
- Work with your local filesystem asynchronously

Resources:
- https://github.com/iterative/morefs/blob/main/src/morefs/asyn_local.py

## Example 1

Save a text file asynchronously to your local filesystem

```python
import asyncio
from morefs.asyn_local import AsyncLocalFileSystem
from pathlib import Path

fp = "/tmp/ganymede_demo"
tfp = f"{fp}/test.txt"
path = Path(fp).mkdir(exist_ok=True)

async def main():
    fs = AsyncLocalFileSystem(auto_mkdir=False)

    async with fs.open_async(tfp, mode="w") as f:
        await f.write("foobar")

    content = await fs._cat(tfp)
    print(content)

    # Alternatively, you can still use sync methods
    print(fs.cat(tfp))

asyncio.run(main())
```
