AIOFile
Real asynchronous file operations with asyncio support.
Status
Development - Stable
Features
Code examples
All code examples requires python 3.5+.
Write and Read
import asyncio
from aiofile import AIOFile, Reader, Writer
async def main():
async with AIOFile("/tmp/hello.txt", 'w+') as afp:
await afp.write("Hello ")
await afp.write("world", offset=7)
await afp.fsync()
print(await afp.read())
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Write and read with helpers
import asyncio
from aiofile import AIOFile, Reader, Writer
async def main():
async with AIOFile("/tmp/hello.txt", 'w+') as afp
writer = Writer(afp)
reader = Reader(afp, chunk_size=8)
await writer("Hello")
await writer(" ")
await writer("World")
await afp.flush()
async for chunk in reader:
print(chunk)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Read file line by line
import asyncio
from aiofile import AIOFile, LineReader, Writer
async def main():
async with AIOFile("/tmp/hello.txt", 'w+') as afp
writer = Writer(afp)
await writer("Hello")
await writer(" ")
await writer("World")
await writer("\n")
await writer("\n")
await writer("From async world")
await afp.flush()
async for line in LineReader(afp):
print(line)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Metadata
Release files for aiofile 1.4.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.4.0.tar.gz | 75.0 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| aiofile-1.4.0-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.4.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.4.0-cp36-cp36m-linux_armv7l.whl | CPython 3.6 | CPython 3.6 pymalloc | linux armv7l | Details |
| aiofile-1.4.0-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.4.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.4.0-cp34-cp34m-manylinux1_x86_64.whl | CPython 3.4 | CPython 3.4 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.4.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: 1.1 MB
Release files / aiofile-1.4.0.tar.gz
| Download URL | aiofile-1.4.0.tar.gz |
|---|---|
| Size | 75.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd8642420821f8a0bb96388d804167e7b1df3dd1d580a5054aac77d7240f0574
|
|
BLAKE2b-256 checksum How to use checksums |
4dc4e599afd81991aeb597545dec91ceda6c38cd9ac5d0d81f476df5fcb640ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | aiofile-1.4.0-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 180.5 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
8401130bf9c2683a53ab63e892644e9baefea7fd945175694c1e2d0cc209a729
|
|
BLAKE2b-256 checksum How to use checksums |
a884b0bd63f86880b10196bde02807994385c502cf46c42e54334453cbefa66e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.4.0-cp36-cp36m-macosx_10_6_intel.whl
| Download URL | aiofile-1.4.0-cp36-cp36m-macosx_10_6_intel.whl |
|---|---|
| Size | 96.4 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
6f8f4309a77802eb812469cd656b05c38be6d44a919f9f9491cf1052fd33497a
|
|
BLAKE2b-256 checksum How to use checksums |
bbbfbf6ce9ac4201acb56b085bfb96e32f4056c6333f16a1bc9a17a16ecc7a01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.4.0-cp36-cp36m-linux_armv7l.whl
| Download URL | aiofile-1.4.0-cp36-cp36m-linux_armv7l.whl |
|---|---|
| Size | 169.2 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc linux armv7l |
|
SHA-256 checksum How to use checksums |
757e07cbfacb74c530e69523794f7512ac82c5b8819dc49fc599270ff7183df7
|
|
BLAKE2b-256 checksum How to use checksums |
6aedcee3fe3ccbe0d05af6723085e024a9af70c2a522f3298b71e84eb2f3b8eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.4.0-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | aiofile-1.4.0-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 182.4 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
2ebacb4d0cf1fd025d016b36e8d92190eb785b9fd5ba1273adb14e1d903bad27
|
|
BLAKE2b-256 checksum How to use checksums |
d430a88e86a42be0f1574aa9534e433756db86109775233175fd30fbd833431c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.4.0-cp35-cp35m-macosx_10_6_intel.whl
| Download URL | aiofile-1.4.0-cp35-cp35m-macosx_10_6_intel.whl |
|---|---|
| Size | 95.4 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
54b49528af0747dbbcb586386fbb39a17245f7423eacf59ff867a322bacb0992
|
|
BLAKE2b-256 checksum How to use checksums |
975495ae85fb308a5fb396cb242f49293a07ca3efc224b3b7d04fccccd1c0fb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.4.0-cp34-cp34m-manylinux1_x86_64.whl
| Download URL | aiofile-1.4.0-cp34-cp34m-manylinux1_x86_64.whl |
|---|---|
| Size | 186.5 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
d332e85a15eeb99013c45215e4dc45cb92c0b7ff0062737887e20b3ce6cc8f98
|
|
BLAKE2b-256 checksum How to use checksums |
7379356c82a1c74cd33eac9221b6048989747f7c418a98fb771ce652c13e19cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.4.0-cp34-cp34m-macosx_10_6_intel.whl
| Download URL | aiofile-1.4.0-cp34-cp34m-macosx_10_6_intel.whl |
|---|---|
| Size | 95.7 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
402350e24e23fd2cb970f6982d4cde983c63b9a411649fcc2528a94f814bc7e3
|
|
BLAKE2b-256 checksum How to use checksums |
4f5faefbadb0c60eab2541c18c2dfa19dec3449fe7bce9b22a57870c25b80953
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |