AIOFile
Real asynchronous file operations with asyncio support.
Status
Development - Stable
Features
Code examples
Totally async read and write:
import asyncio
from aiofile import AIOFile, Reader, Writer
async def main(loop):
aio_file = await AIOFile("/tmp/hello.txt", 'w+', loop=loop)
await aio_file.write(b"Hello ")
await aio_file.write(b"world", offset=7)
await aio_file.fsync()
print(await aio_file.read())
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
Write and read with helpers:
import asyncio
from aiofile import AIOFile, Reader, Writer
async def main(loop):
aio_file = await AIOFile("/tmp/hello.txt", 'w+', loop=loop)
writer = Writer(aio_file)
reader = Reader(aio_file, chunk_size=8)
await writer(b"Hello")
await writer(b" ")
await writer(b"World")
await aio_file.flush()
async for chunk in reader:
print(chunk)
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
or use async context manager:
import asyncio
from aiofile import AIOFile, Reader, Writer
async def main(loop):
async with AIOFile("/tmp/hello.txt", 'w+', loop=loop) as aio_file:
writer = Writer(aio_file)
reader = Reader(aio_file, chunk_size=8)
await writer(b"Hello")
await writer(b" ")
await writer(b"World")
await aio_file.flush()
async for chunk in reader:
print(chunk)
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
Metadata
Release files for aiofile 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiofile-1.2.0.tar.gz | 74.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| aiofile-1.2.0-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.2.0-cp36-cp36m-macosx_10_6_intel.whl | CPython 3.6 | CPython 3.6 pymalloc | macOS 10.6+ Intel (x86-64, i386) | Details |
| aiofile-1.2.0-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.2.0-cp35-cp35m-macosx_10_6_intel.whl | CPython 3.5 | CPython 3.5 pymalloc | macOS 10.6+ Intel (x86-64, i386) | Details |
| aiofile-1.2.0-cp34-cp34m-manylinux1_x86_64.whl | CPython 3.4 | CPython 3.4 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.2.0-cp34-cp34m-macosx_10_6_intel.whl | CPython 3.4 | CPython 3.4 pymalloc | macOS 10.6+ Intel (x86-64, i386) | Details |
Total release size: 922.7 kB
Release files / aiofile-1.2.0.tar.gz
| Download URL | aiofile-1.2.0.tar.gz |
|---|---|
| Size | 74.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0145d345ab3113bb8e4bbefd9dca635cd4d8af459d769d34f0c5e639c6401e1
|
|
BLAKE2b-256 checksum How to use checksums |
c60a5c32c1613f3bad674a3c7dd544a97bfc2a04d1e3d707c2d6d772dc62ebd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.0-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | aiofile-1.2.0-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 183.5 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
b6561c9e074617549afd3ac2cd13fd9fe5b1bdd8b7841b874a17dfb4f4416f02
|
|
BLAKE2b-256 checksum How to use checksums |
a2fa07c795d34cd6b371f872fca55758f20370f793c4b199aa884f52bc84f369
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.0-cp36-cp36m-macosx_10_6_intel.whl
| Download URL | aiofile-1.2.0-cp36-cp36m-macosx_10_6_intel.whl |
|---|---|
| Size | 97.6 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
98d72c999423fbf8231127d18ad4fadd8c434715731c2bb48555bbbfa79ae2c7
|
|
BLAKE2b-256 checksum How to use checksums |
00c1b6ade812646b1ef7d1ffc2d660f840d892b53366e61a951e49bdb42d93bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.0-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | aiofile-1.2.0-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 184.2 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
9f78519b2e5d03dc6a6ffdc352b565cb8391ddc78a2a4cf519fd182ea2ce64c0
|
|
BLAKE2b-256 checksum How to use checksums |
16e800edeb297ad22b1c2f1f564102fddca804d5524eae277164637637573ca3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.0-cp35-cp35m-macosx_10_6_intel.whl
| Download URL | aiofile-1.2.0-cp35-cp35m-macosx_10_6_intel.whl |
|---|---|
| Size | 96.4 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
33f1d807bbe5b6147c562e70e0921c1fd3797f092294e77090e7b2033f4fd824
|
|
BLAKE2b-256 checksum How to use checksums |
f0aa50e3aa65d54cf278e95babe37dcd0fe457ec28afe10aa850f3c5644ffe85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.0-cp34-cp34m-manylinux1_x86_64.whl
| Download URL | aiofile-1.2.0-cp34-cp34m-manylinux1_x86_64.whl |
|---|---|
| Size | 189.4 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
9e470a305014ad591d432e561b625a173a6c4bfb6061a5338ba0cd23b92f9d64
|
|
BLAKE2b-256 checksum How to use checksums |
e49a6238fd0128e50e5adb653a6612bbdf84b5d31e84e87cc1d443119eadd623
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.0-cp34-cp34m-macosx_10_6_intel.whl
| Download URL | aiofile-1.2.0-cp34-cp34m-macosx_10_6_intel.whl |
|---|---|
| Size | 96.7 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
6cb2821473909c58ca630ff558c2b94123bab6ec6f45f6cf8935733cae53a28e
|
|
BLAKE2b-256 checksum How to use checksums |
86bd6ba40a0ca7be47e056bf441b5182e259abb6707bc3319732d1e39e3cf40b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |