Expand description
Async filesystem primitives.
This crate is an async version of std::fs
.
§Implementation
This crate uses blocking
to offload blocking I/O onto a thread pool.
§Examples
Create a new file and write some bytes to it:
use async_fs::File;
use futures_lite::io::AsyncWriteExt;
let mut file = File::create("a.txt").await?;
file.write_all(b"Hello, world!").await?;
file.flush().await?;
Re-exports§
pub use std::fs::FileType;
pub use std::fs::Metadata;
pub use std::fs::Permissions;
Modules§
- unix
- Unix-specific extensions.
Structs§
- DirBuilder
- A builder for creating directories with configurable options.
- DirEntry
- An entry in a directory.
- File
- An open file on the filesystem.
- Open
Options - A builder for opening files with configurable options.
- ReadDir
- A stream of entries in a directory.
Functions§
- canonicalize
- Returns the canonical form of a path.
- copy
- Copies a file to a new location.
- create_
dir - Creates a new, empty directory at the provided path
- create_
dir_ all - Recursively create a directory and all of its parent components if they are missing.
- hard_
link - Creates a hard link on the filesystem.
- metadata
- Reads metadata for a path.
- read
- Reads the entire contents of a file as raw bytes.
- read_
dir - Returns a stream of entries in a directory.
- read_
link - Reads a symbolic link and returns the path it points to.
- read_
to_ string - Reads the entire contents of a file as a string.
- remove_
dir - Removes an empty directory.
- remove_
dir_ all - Removes a directory and all of its contents.
- remove_
file - Removes a file.
- rename
- Renames a file or directory to a new location.
- set_
permissions - Changes the permissions of a file or directory.
- symlink_
metadata - Reads metadata for a path without following symbolic links.
- write
- Writes a slice of bytes as the new contents of a file.