POSIX Pipe async helper
Project description
Real asynchronous file operations with asyncio support.
Status
Development - BETA
Features
Code examples
Totally async read and write:
import asyncio
from aiofile import AIOFile, Reader, Writer
async def main(loop):
aio_file = AIOFile("/tmp/hello.txt", 'w+', loop=loop)
await aio_file.write(b"Hello ")
await aio_file.write(b"world", offset=7)
await aio_file.flush()
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 = 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))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aio-pipe-0.1.0.tar.gz
(39.8 kB
view details)
Built Distributions
File details
Details for the file aio-pipe-0.1.0.tar.gz
.
File metadata
- Download URL: aio-pipe-0.1.0.tar.gz
- Upload date:
- Size: 39.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6931abf2b1f27796a3ae33445acbc744394677133df822a4e503df06561dca60 |
|
MD5 | 3aba773e42147da85737f12b8a366a16 |
|
BLAKE2b-256 | 8360e546521d7b5ce378f5189fe5d17c1bedb6ce20af74f60724b66b33a37034 |
File details
Details for the file aio_pipe-0.1.0-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: aio_pipe-0.1.0-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 149.3 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50eb8e349b553c578a7dde2656ee827b294c55068e722921ca040db02bdd1de1 |
|
MD5 | 58b35754419e3da2a1f2b77182c3cee9 |
|
BLAKE2b-256 | 19bfd649372a008dabd1513a583473e4cf8da24d9d9c6a4a5ade9f4eaf847830 |
File details
Details for the file aio_pipe-0.1.0-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: aio_pipe-0.1.0-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 143.2 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 529943125a4c14e405fe9c1a1f4a969c8b209704b3e1a095c0169b09876c26f0 |
|
MD5 | 433f02fd5f7e41755a0ba039b110a241 |
|
BLAKE2b-256 | 6cfb9ed816d7686595640576eb8a2828c3917c374906c9efcb46e8d45be37dde |
File details
Details for the file aio_pipe-0.1.0-cp35-cp35m-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: aio_pipe-0.1.0-cp35-cp35m-macosx_10_12_x86_64.whl
- Upload date:
- Size: 28.8 kB
- Tags: CPython 3.5m, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 280e902013a99f446fc7f0c78d50dd735bdff8250c722dfc5015fa969ffad25d |
|
MD5 | e2654d9b6de14fe398e6a3cee2d36572 |
|
BLAKE2b-256 | be556852552842263985ece7510b2506a8cfb5ca931bad7c105a64ad3004d13e |
File details
Details for the file aio_pipe-0.1.0-cp34-cp34m-manylinux1_x86_64.whl
.
File metadata
- Download URL: aio_pipe-0.1.0-cp34-cp34m-manylinux1_x86_64.whl
- Upload date:
- Size: 147.3 kB
- Tags: CPython 3.4m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf51d797081235534904ec34d72883cc57122294db92613ee7251ddeae58a4f1 |
|
MD5 | 0b62bfb7486f870019a78df0f7af777f |
|
BLAKE2b-256 | 3627854d3e0256ecd9fa7e3d8e7532c37901f840458387fc2c3d838369841e22 |