std.fs.attribute

*empty*

dynamic

+file-permissions+

attr

added in 3.0

(attr name value)(attr name value prefix)

creates an attribute for input to various functions

attr-value

added in 3.0

(attr-value k v)

adjusts the attribute value for input

attributes

added in 3.0

(attributes path)

shows all attributes for a given path

(attributes “project.clj”) ;; {:owner “chris”, ;; :group “staff”, ;; :permissions “rw-r–r–”, ;; :file-key “(dev=1000004,ino=2351455)”, ;; :ino 2351455, ;; :is-regular-file true. ;; :is-directory false, :uid 501, ;; :is-other false, :mode 33188, :size 4342, ;; :gid 20, :ctime 1476755481000, ;; :nlink 1, ;; :last-access-time 1476755481000, ;; :is-symbolic-link false, ;; :last-modified-time 1476755481000, ;; :creation-time 1472282953000, ;; :dev 16777220, :rdev 0} => map

attrs->map

added in 3.0

(attrs->map attrs)

converts the map of attributes into a clojure map

from-permissions

added in 3.0

(from-permissions modes)

transforms permissions to mode

(from-permissions :owner-read :group-read :group-execute :others-read :others-execute) => “455”

lookup-group

added in 3.0

(lookup-group group)

lookup the user registry for the name

(lookup-group “WRONG”) => (throws)

lookup-owner

added in 3.0

(lookup-owner owner)

lookup the user registry for the name

(lookup-owner “WRONG”) => (throws)

map->attr-array

added in 3.0

(map->attr-array m)(map->attr-array m prefix)

converts a clojure map to an array of attrs

owner

added in 3.0

(owner path)

returns the owner of the file

(owner “project.clj”) => string?

set-attributes

added in 3.0

(set-attributes path m)

sets all attributes for a given path

(set-attributes “project.clj” {:owner “chris”, :group “staff”, :permissions “rw-rw-rw-”}) ;;=> #path:“/Users/chris/Development/chit/lucidity/project.clj”

set-owner

added in 3.0

(set-owner path owner)

sets the owner of a particular file

(set-owner “test” “WRONG”) => (throws)

to-mode-number

added in 3.0

(to-mode-number s)

transforms mode numbers to mode strings

(to-mode-number “r–r-xr-x”) => “455”

(to-mode-number “rwxrwxrwx”) => “777”

to-mode-string

added in 3.0

(to-mode-string s)

transforms mode numbers to mode strings

(to-mode-string “455”) => “r–r-xr-x”

(to-mode-string “777”) => “rwxrwxrwx”

to-permissions

added in 3.0

(to-permissions s)

transforms mode to permissions

(to-permissions “455”) => (contains :owner-read :group-read :group-execute :others-read :others-execute :in-any-order)