tokio::fs

Function try_exists

Source
pub async fn try_exists(path: impl AsRef<Path>) -> Result<bool>
Available on crate feature fs only.
Expand description

Returns Ok(true) if the path points at an existing entity.

This function will traverse symbolic links to query information about the destination file. In case of broken symbolic links this will return Ok(false).

This is the async equivalent of std::path::Path::try_exists.

ยงExamples

use tokio::fs;

fs::try_exists("foo.txt").await?;