aiofile
raw JSON → 3.9.0 verified Tue May 12 auth: no python install: verified
aiofile provides real asynchronous file operations for asyncio applications. It addresses the blocking nature of ordinary file I/O by delegating operations to a separate thread pool, ensuring that file operations do not block the asyncio event loop. The library is Apache2 licensed, currently at version 3.9.0, and maintains a stable development status.
Install
pip install aiofile Install compatibility verified
python os / libc status wheel install import disk mem side effects
3.10 alpine (musl) wheel - 0.23s 18.0M 7.2M clean
3.10 alpine (musl) - - 0.27s 18.0M 7.2M -
3.10 slim (glibc) wheel 1.6s 0.18s 19M 7.2M clean
3.10 slim (glibc) - - 0.20s 19M 7.2M -
3.11 alpine (musl) wheel - 0.31s 19.9M 8.3M clean
3.11 alpine (musl) - - 0.37s 19.9M 8.3M -
3.11 slim (glibc) wheel 1.7s 0.29s 21M 8.5M clean
3.11 slim (glibc) - - 0.29s 21M 8.5M -
3.12 alpine (musl) wheel - 0.51s 11.8M 8.4M clean
3.12 alpine (musl) - - 0.59s 11.8M 8.4M -
3.12 slim (glibc) wheel 1.5s 0.49s 12M 8.4M clean
3.12 slim (glibc) - - 0.56s 12M 8.4M -
3.13 alpine (musl) wheel - 0.54s 11.5M 8.8M clean
3.13 alpine (musl) - - 0.59s 11.4M 8.8M -
3.13 slim (glibc) wheel 1.5s 0.49s 12M 8.8M clean
3.13 slim (glibc) - - 0.56s 12M 8.8M -
3.9 alpine (musl) build_error - - - - - -
3.9 alpine (musl) - - - - - -
3.9 slim (glibc) wheel 1.9s 0.19s 18M 7.2M clean
3.9 slim (glibc) - - 0.23s 18M 7.2M -
Imports
from aiofile import async_openfrom aiofile import AIOFile Quickstart last tested: 2026-04-24
import asyncio
from aiofile import async_open
async def main():
# Write to a file asynchronously
async with async_open("hello.txt", mode="w+") as f:
await f.write("Hello, aiofile!")
await f.seek(0)
content = await f.read()
print(f"Read: {content}")
# Read a file line by line asynchronously
async with async_open("hello.txt", mode="r") as f:
async for line in f:
print(f"Line: {line.strip()}")
asyncio.run(main())