diff --git a/CHANGELOG.md b/CHANGELOG.md index 519f178..456be30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +- Add documentation for 'mode' field in FileInfo. + ## Unreleased ## v2.3.0 - 24 June 2025 diff --git a/src/simplifile.gleam b/src/simplifile.gleam index 4bdabab..f908e3b 100644 --- a/src/simplifile.gleam +++ b/src/simplifile.gleam @@ -184,6 +184,15 @@ pub type FileInfo { /// File size in bytes. size: Int, /// File mode that indicates the file type and its permissions. + /// + /// This field enocodes file type and permissions in a 16 bit int in + /// the following order + /// - bits 15-12: File Type. e.g RegularFile, Symlink, Directory + /// - bits 11-9 : Special file permissions such as setUserId, setGroupId, and the Sticky-bit + /// - bits 8-6 : User read, write, and execute permisions. + /// - bits 5-3 : Group read, write, and execute permissions. + /// - bits 2-0 : Other read, write, and execute permissions. + /// /// For example, in Unix and Linux, a mode value of 33188 indicates /// a regular file and the permissions associated with it /// (read and write for the owner, and read-only for others, in