aiofiles

25.1.0 · active · verified Sat Mar 28

aiofiles is a Python library that provides asynchronous file operations for asyncio applications, enabling non-blocking file I/O. The current version is 25.1.0, released on October 9, 2025. The library follows a regular release cadence, with updates approximately every few months.

Warnings

Install

Imports

Quickstart

This example demonstrates how to asynchronously read a file using aiofiles. The 'open' function from aiofiles is used to open the file, and 'await' is used to read its contents without blocking the event loop.

import aiofiles
import asyncio

async def read_file():
    async with aiofiles.open('example.txt', mode='r') as f:
        contents = await f.read()
        print(contents)

asyncio.run(read_file())

view raw JSON →