#unix-file #file-permissions #mode

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

#349 in Unix APIs

Download history 1713/week @ 2024-07-29 1860/week @ 2024-08-05 1318/week @ 2024-08-12 1619/week @ 2024-08-19 1221/week @ 2024-08-26 1318/week @ 2024-09-02 1081/week @ 2024-09-09 1286/week @ 2024-09-16 1451/week @ 2024-09-23 2602/week @ 2024-09-30 1429/week @ 2024-10-07 2853/week @ 2024-10-14 1648/week @ 2024-10-21 1972/week @ 2024-10-28 1892/week @ 2024-11-04 1349/week @ 2024-11-11

7,015 downloads per month
Used in 15 crates (12 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

~160KB