#file-permissions #read-write #file

permissions

Library to query for file permissions (read, write, execute, removal and creation)

8 releases (4 breaking)

0.5.1 Sep 4, 2023
0.4.1 Nov 18, 2022
0.3.0 Mar 4, 2021
0.2.1 Apr 25, 2022
0.0.1 Sep 22, 2020

#491 in Filesystem

Download history 543/week @ 2024-09-24 396/week @ 2024-10-01 333/week @ 2024-10-08 327/week @ 2024-10-15 294/week @ 2024-10-22 345/week @ 2024-10-29 424/week @ 2024-11-05 709/week @ 2024-11-12 322/week @ 2024-11-19 188/week @ 2024-11-26 295/week @ 2024-12-03 265/week @ 2024-12-10 245/week @ 2024-12-17 167/week @ 2024-12-24 263/week @ 2024-12-31 329/week @ 2025-01-07

1,023 downloads per month
Used in 9 crates (6 directly)

MIT license

13KB
72 lines

NOTE

If you want Windows support, check faccess instead.

permissions

Crates.io License Docs.rs

Useful filesystem queries for file permissions:

See functions.

Examples:

use permissions::*;

fn main() -> std::io::Result<()> {
   // Functions accept `AsRef<Path>`
   assert!(is_readable("src/")?);
   assert!(is_writable("src/")?);
   assert!(is_writable("src/lib.rs")?);
   assert!(is_executable("/usr/bin/cat")?);
   assert!(is_removable("src/lib.rs")?);
   assert!(is_creatable("src/file.rs")?);

   Ok(())
}

Alternatives

  • faccess - it provides Windows support and a trait-based API.

Dependencies

~43KB