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.3.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.3.0.tar.gz | 75.6 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| aiofile-1.3.0-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.3.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.3.0-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.3.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.3.0-cp34-cp34m-manylinux1_x86_64.whl | CPython 3.4 | CPython 3.4 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.3.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: 927.0 kB
Release files / aiofile-1.3.0.tar.gz
| Download URL | aiofile-1.3.0.tar.gz |
|---|---|
| Size | 75.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88a57a8f47560516f2025429bd62dbaeb141b1285cead4276bfaa3269cd85079
|
|
BLAKE2b-256 checksum How to use checksums |
3536c31f828248c54fea73ddd265063ecf527463d78ed627e23c9afcca56ee71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.3.0-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | aiofile-1.3.0-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 184.2 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
f4ea892a2bbdc5495bbfb35a26735448561b319b6cba127fcae2adc92ef17ea4
|
|
BLAKE2b-256 checksum How to use checksums |
abe9579ae3abc8e798b4aa9cd7b582e27f7d2e51261b83129643a1d4cbfddcbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.3.0-cp36-cp36m-macosx_10_6_intel.whl
| Download URL | aiofile-1.3.0-cp36-cp36m-macosx_10_6_intel.whl |
|---|---|
| Size | 98.2 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
c09eedf16d3d993823ecac3578b09c2c5610f07866ae0af026f289157e0f9700
|
|
BLAKE2b-256 checksum How to use checksums |
546cbf81c0bfe70d2d8f4f965ec4f6a4d411a9b58fd573132bd6fb6181f2303f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.3.0-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | aiofile-1.3.0-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 184.8 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
3a4e51e77f58f17c8642583ebcb9f0b5fa5709e844d2cf2255f003ae802aba38
|
|
BLAKE2b-256 checksum How to use checksums |
8a28b220029ae3f786f68ce11bb35b7dc0da4abd49a8074a9d26392fc3ec3b9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.3.0-cp35-cp35m-macosx_10_6_intel.whl
| Download URL | aiofile-1.3.0-cp35-cp35m-macosx_10_6_intel.whl |
|---|---|
| Size | 97.0 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
65f00f0da4679d96217980029b3d06da216915483fc19d48d77319838777fa10
|
|
BLAKE2b-256 checksum How to use checksums |
c3cce0511b844e03b498b87032ad5d7ba152525dfe594a7fac9a170ee7c53463
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.3.0-cp34-cp34m-manylinux1_x86_64.whl
| Download URL | aiofile-1.3.0-cp34-cp34m-manylinux1_x86_64.whl |
|---|---|
| Size | 190.0 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
aaa8f3612e1f3084ec8627ff16a1ddfe3b090aa34c1ce523ba7b7e3fb26a0c7f
|
|
BLAKE2b-256 checksum How to use checksums |
27933c0bdc0544270bcbd2937ce3fa14d5edb05845f3d47ee6d2492819b212ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.3.0-cp34-cp34m-macosx_10_6_intel.whl
| Download URL | aiofile-1.3.0-cp34-cp34m-macosx_10_6_intel.whl |
|---|---|
| Size | 97.3 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
f3316a454d9799febd003a5a5b3d8e7c26d16438833fa9b3d886bcf4bc9961d8
|
|
BLAKE2b-256 checksum How to use checksums |
7df177ca6a057bb526944b545097b0e896c70ab41969c1ec42455a8527f180fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |