| 1 | # async-fs |
| 2 | |
| 3 | []( |
| 4 | https://github.com/smol-rs/async-fs/actions/workflows/ci.yml) |
| 5 | []( |
| 6 | https://github.com/smol-rs/async-fs) |
| 7 | []( |
| 8 | https://crates.io/crates/async-fs) |
| 9 | []( |
| 10 | https://docs.rs/async-fs) |
| 11 | |
| 12 | Async filesystem primitives. |
| 13 | |
| 14 | This crate is an async version of `std::fs`. |
| 15 | |
| 16 | ## Implementation |
| 17 | |
| 18 | This crate uses [`blocking`] to offload blocking I/O onto a thread pool. |
| 19 | |
| 20 | [`blocking`]: https://docs.rs/blocking |
| 21 | |
| 22 | ## Examples |
| 23 | |
| 24 | Create a new file and write some bytes to it: |
| 25 | |
| 26 | ```rust |
| 27 | use async_fs::File; |
| 28 | use futures_lite::io::AsyncWriteExt; |
| 29 | |
| 30 | let mut file = File::create("a.txt").await?; |
| 31 | file.write_all(b"Hello, world!").await?; |
| 32 | file.flush().await?; |
| 33 | ``` |
| 34 | |
| 35 | ## License |
| 36 | |
| 37 | Licensed under either of |
| 38 | |
| 39 | * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) |
| 40 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) |
| 41 | |
| 42 | at your option. |
| 43 | |
| 44 | #### Contribution |
| 45 | |
| 46 | Unless you explicitly state otherwise, any contribution intentionally submitted |
| 47 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be |
| 48 | dual licensed as above, without any additional terms or conditions. |