Here's how to obtain the numerical value of the chmod permissions of a file on macOS. (Note that this method also works for directories.)
stat -f %A file.md
# 755
Let's give it a try.
First, create a new file and set its permissions.
touch text.md
chmod 777 text.md
Then we can retrieve its chmod number.
stat -f %A text.md
# 777
And here's how to retrieve it's chmod string value.
ls -n text.md
# -rwxrwxrwx 1 501 20 0 Jun 21 13:53 text.md*
This method also works for directories.