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.2.5
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.5.tar.gz | 75.4 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| aiofile-1.2.5-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.2.5-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.5-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.2.5-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.5-cp34-cp34m-manylinux1_x86_64.whl | CPython 3.4 | CPython 3.4 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.2.5-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: 925.3 kB
Release files / aiofile-1.2.5.tar.gz
| Download URL | aiofile-1.2.5.tar.gz |
|---|---|
| Size | 75.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
854ba84fedbdb56cdc5d552d269435ee8b90ac02fabb7dfb48a9d09b6df11667
|
|
BLAKE2b-256 checksum How to use checksums |
22e28a5867f67b3e3d56164f68286cb5db9a2cd955f6ed0b172dfeedab4ce959
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.5-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | aiofile-1.2.5-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 183.9 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
b4a9f91efee1a5588fc1e8a31706d34ebfc2d7cbc29eb47d184505da952d0e36
|
|
BLAKE2b-256 checksum How to use checksums |
59cd6efc8807b292718deae7a90a0079c866be0f2a98fa097fc671e339350a71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.5-cp36-cp36m-macosx_10_6_intel.whl
| Download URL | aiofile-1.2.5-cp36-cp36m-macosx_10_6_intel.whl |
|---|---|
| Size | 97.9 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
f02412b6317d3f39adb4d65a0a1cf9937b92e675063de21c2bfc9f245b5814a5
|
|
BLAKE2b-256 checksum How to use checksums |
c13e0edda1662b9170131dad09355e17b9997df5870dcc6c27a1d705b088aa13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.5-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | aiofile-1.2.5-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 184.5 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
cfadcd3fc117e87f7038420feb08bd51fead4c46f897f379a50df1690f7d05ec
|
|
BLAKE2b-256 checksum How to use checksums |
39471c82b16d8cb8350f9f942f7081c580bb992646574c17759ff7644a34e35e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.5-cp35-cp35m-macosx_10_6_intel.whl
| Download URL | aiofile-1.2.5-cp35-cp35m-macosx_10_6_intel.whl |
|---|---|
| Size | 96.7 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
c1c3b76fb4fece1742297ba1764f82701ef965a07c024d7e4837a9e669475b18
|
|
BLAKE2b-256 checksum How to use checksums |
1ba39b52c19b625b8193b997abcea7e335915c3c03b9bf4648f87b79479692f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.5-cp34-cp34m-manylinux1_x86_64.whl
| Download URL | aiofile-1.2.5-cp34-cp34m-manylinux1_x86_64.whl |
|---|---|
| Size | 189.7 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
3317c957cf401305a1b2065a6c5389978ab4c9e2c1e2936a539510ac908aaf7e
|
|
BLAKE2b-256 checksum How to use checksums |
fb9b4e9fadf0e747e9b5c2ba77f62f7a13a0e0e6f43820ee892502fd93168ea3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.5-cp34-cp34m-macosx_10_6_intel.whl
| Download URL | aiofile-1.2.5-cp34-cp34m-macosx_10_6_intel.whl |
|---|---|
| Size | 97.1 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
71a0075767c64168b433af1566a1d62ce23e58fd47e4174c1082b2378ea06ee1
|
|
BLAKE2b-256 checksum How to use checksums |
8d0f5fac336220315580d44d23bca8904fe36496939a98020fc675dff136d720
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |