pub async fn metadata<P: AsRef<Path>>(path: P) -> Result<Metadata>
Expand description
Reads metadata for a path.
This function will traverse symbolic links to read metadata for the target file or directory.
If you want to read metadata without following symbolic links, use symlink_metadata
instead.
This function is an async version of std::fs::metadata
.
Errors
An error will be returned in the following situations:
path
does not point to an existing file or directory.- The current process lacks permissions to read metadata for the path.
- Some other I/O error occurred.
Examples
use async_std::fs;
let perm = fs::metadata("a.txt").await?.permissions();