Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Niraj-Kamdar authored Oct 21, 2020
1 parent bcb91b7 commit c20b2b4
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,20 @@ class TemporaryFile(FileIO):
OPEN = _TemporaryFile
```

You can do same for any IO classes like `GzipFile`, `SpooledTemporaryFile`, etc.
You can do same for any other IO classes like `gzip.GzipFile`, `zipfile.ZipFile`, etc.
I have added async version of tempfile and gzip modules in the `v0.2`
since they are commonly used modules and I will add more modules in the future releases.
You can use these modules just like you use standard library module, only difference is you need to await coroutine methods.
You can request for support for new modules by [creating new issue](https://github.com/Niraj-Kamdar/async-files/issues/new).

You can also create coroutine from any blocking function by using async-files's utility function `async_wraps`. For example:
```python
import shutil
from async_files.utils import async_wraps
async_rmtree = async_wraps(shutil.rmtree)
```
You can also use `async_wraps` as a decorator for your custom function.
> Note: Only use `async_wraps` if target function is IO-bound.
Following are asynchronous attributes of the FileIO object.
```python
Expand All @@ -58,3 +71,11 @@ write: Callable[[Union[str, bytes]], Awaitable[int]]
writelines: Callable[[List[Union[str, bytes]]], Awaitable[None]]
```
Other attributes are synchronous just like standard library fileobj.

## Feedback & Contributions
Bugs and feature requests can be made via [GitHub issues](https://github.com/Niraj-Kamdar/async-files/issues/new).
Be aware that these issues are not private, so take care when providing output to make sure you are not disclosing security issues in other products.

Pull requests are also welcome via git.

The async-files uses `sourcery`, `restyled` and `code factor` bots to ensure code quality of the PR.

0 comments on commit c20b2b4

Please sign in to comment.