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.1
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.1.tar.gz | 75.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| aiofile-1.2.1-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.2.1-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.1-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.2.1-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.1-cp34-cp34m-manylinux1_x86_64.whl | CPython 3.4 | CPython 3.4 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| aiofile-1.2.1-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: 924.8 kB
Release files / aiofile-1.2.1.tar.gz
| Download URL | aiofile-1.2.1.tar.gz |
|---|---|
| Size | 75.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2134cabed0d65aa2ccde5e3cfbb25ec66471a98e8a125e6be3345d6f51b6d1d8
|
|
BLAKE2b-256 checksum How to use checksums |
d303b65ce7b1f3de824c8369a9a8b516cc2abfe2fdc1d08689f70a9d96db6af4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.1-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | aiofile-1.2.1-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 183.8 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
d82475dd0fbc795208b25248fdfc6437df0d9c64727240cb2ca12ca18b17c91a
|
|
BLAKE2b-256 checksum How to use checksums |
d4a6f37c12d085fda0bef4a6d4c60c224ea6232e0013ddfe83b7d8dacc9cfb35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.1-cp36-cp36m-macosx_10_6_intel.whl
| Download URL | aiofile-1.2.1-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 |
b5e1e3a6bfb79ec681898447cccad79d59b112294053c3e59579c932f08bf6e7
|
|
BLAKE2b-256 checksum How to use checksums |
f766d428278432c51e16152ee09ff5d900dbab03e6f54d07f786d5aa75c81831
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.1-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | aiofile-1.2.1-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 |
2d5fda6d816819c1e61e6100749d9690aed0e1895fd9eca9858fc2c2d8c21542
|
|
BLAKE2b-256 checksum How to use checksums |
18e582353dc4022d859b280d3afa5417a6067915b9de57e64c5801dfda36c7d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.1-cp35-cp35m-macosx_10_6_intel.whl
| Download URL | aiofile-1.2.1-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 |
bcc55b5603f6773d10562a3b0a47a60f80347fe5fe4a3b550cef2acb1670b05a
|
|
BLAKE2b-256 checksum How to use checksums |
be0abdb3d36fa9e5b3daf881ddf3481a7d8b3791c53f8caa38c5cdfa525e825c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.1-cp34-cp34m-manylinux1_x86_64.whl
| Download URL | aiofile-1.2.1-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 |
79e2ffc431c8572b63d81d9a94ee52a109c0f92210b0baade691c468c190aea5
|
|
BLAKE2b-256 checksum How to use checksums |
410e942bfcbb8ec60441e49dbe350f6557d6ccb33b34809a18001cca28826ab1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aiofile-1.2.1-cp34-cp34m-macosx_10_6_intel.whl
| Download URL | aiofile-1.2.1-cp34-cp34m-macosx_10_6_intel.whl |
|---|---|
| Size | 97.0 kB |
| Tags | CPython 3.4 CPython 3.4 pymalloc macOS 10.6+ Intel (x86-64, i386) |
|
SHA-256 checksum How to use checksums |
508550ead9ffff0d8a71d06a2bdee855d0066666c73480cf2cde33b1a7e9a83e
|
|
BLAKE2b-256 checksum How to use checksums |
08aff4778a44299ab0f6fa348ed3974fd3ae174107d9f277b8d645e52675f75c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |