Node.FS.Perms
- Package
- purescript-node-fs
- Repository
- purescript-node/purescript-node-fs
#Perm Source
newtype Perm
A Perm
value specifies what is allowed to be done with a particular
file by a particular class of user — that is, whether it is
readable, writable, and/or executable. It has a Semiring
instance, which
allows you to combine permissions:
(+)
addsPerm
values together. For example,read + write
means "readable and writable".(*)
masks permissions. It can be thought of as selecting only the permissions that twoPerm
values have in common. For example:(read + write) * (write + execute) == write
.
You can think also of a Perm
value as a subset of the set
{ read, write, execute }
; then, (+)
and (*)
represent set union and
intersection respectively.
Instances
#permsFromString Source
permsFromString :: String -> Maybe Perms
Attempt to parse a Perms
value from a String
containing an octal
integer. For example,
permsFromString "0644" == Just (mkPerms (read + write) read read)
.
#permsToString Source
permsToString :: Perms -> String
Convert a Perms
value to an octal string, in a format similar to that
accepted by chmod
. For example:
permsToString (mkPerms (read + write) read read) == "0644"
#permsToInt Source
permsToInt :: Perms -> Int
Convert a Perms
value to an Int
, via permsToString
.