#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

#454 in Filesystem

Download history 341/week @ 2024-07-21 355/week @ 2024-07-28 533/week @ 2024-08-04 699/week @ 2024-08-11 900/week @ 2024-08-18 883/week @ 2024-08-25 1190/week @ 2024-09-01 772/week @ 2024-09-08 797/week @ 2024-09-15 665/week @ 2024-09-22 305/week @ 2024-09-29 394/week @ 2024-10-06 362/week @ 2024-10-13 276/week @ 2024-10-20 338/week @ 2024-10-27 430/week @ 2024-11-03

1,419 downloads per month
Used in 10 crates (7 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

~44KB