[−][src]Function async_std::fs::set_permissions
pub async fn set_permissions<P: AsRef<Path>>(
path: P,
perm: Permissions
) -> Result<()>
Changes the permissions on a file or directory.
This function is an async version of std::fs::set_permissions
.
Errors
An error will be returned in the following situations (not an exhaustive list):
path
does not exist.- The current process lacks permissions to change attributes of
path
.
Examples
use async_std::fs; let mut perm = fs::metadata("a.txt").await?.permissions(); perm.set_readonly(true); fs::set_permissions("a.txt", perm).await?;