#file-permissions #unix-file #mode #bits #decode #display #interpret

unix_mode

Decode, interpret, and display Unix file mode bits (even on non-Unix platforms)

5 releases

0.1.4 Aug 12, 2023
0.1.3 Oct 26, 2021
0.1.2 Aug 1, 2021
0.1.1 May 9, 2020
0.1.0 May 8, 2020

#144 in Unix APIs

Download history 1779/week @ 2023-12-13 2262/week @ 2023-12-20 938/week @ 2023-12-27 2837/week @ 2024-01-03 2430/week @ 2024-01-10 1234/week @ 2024-01-17 1846/week @ 2024-01-24 2144/week @ 2024-01-31 1535/week @ 2024-02-07 1624/week @ 2024-02-14 2719/week @ 2024-02-21 2063/week @ 2024-02-28 2396/week @ 2024-03-06 2263/week @ 2024-03-13 1948/week @ 2024-03-20 1171/week @ 2024-03-27

8,215 downloads per month
Used in 13 crates (10 directly)

Apache-2.0

12KB
133 lines

unix_mode: Decode, interpret, and display Unix file mode bits

crates.io docs.rs Tests

unix_mode provides functions to decode, interpret, and display Unix mode bits and permissions, even on non-Unix platforms.

On Unix, decoding is supported by std::os::unix::fs in the standard library, but this crate adds a function to render them in the format used by ls -l, and to understand the file type and permissions.

assert_eq!(unix_mode::to_string(0o0040755), "drwxr-xr-x");
assert_eq!(unix_mode::to_string(0o0100640), "-rw-r-----");

assert_eq!(unix_mode::is_symlink(0o0040755), false);

For API documentation see https://docs.rs/unix_mode.

License

Apache-2.0.

Contributing

Patches are very welcome.

Please read the contribution guidelines and code of conduct.

Disclaimer

This is not an official Google project. It is not supported by Google, and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.

Dependencies

~170KB