    [yada.protocols :as p]
    [yada.media-type :as mt])
   (:import [java.io File]
+           [java.nio.file Files]
+           [java.nio.file.attribute PosixFileAttributeView PosixFilePermissions]
            [java.util Date TimeZone]
            [java.text SimpleDateFormat]
            [java.nio.charset Charset]))

             (str (.getName child) \newline)))

    "text/html"
    (with-newline
      (html
       [:html
        [:head
         [:title (.getName dir)]]
        [:body
         [:table {:style "font-family: monospace"}
          [:thead
           [:tr
            [:th "Name"]
            [:th "Size"]
            [:th "Last modified"]]]
          [:tbody
           (for [child (sort (.listFiles dir))]
             [:tr
              [:td [:a {:href (if (.isDirectory child) (str (.getName child) "/") (.getName child))} (.getName child)]]
              [:td {:style "align: right"}
               (if (.isDirectory child) "" (.length child))]
              [:td (.format
                    (doto (SimpleDateFormat. "yyyy-MM-dd HH:mm:ss zzz")
                      (.setTimeZone (TimeZone/getTimeZone "UTC")))
                    (java.util.Date. (.lastModified child)))]])]]]]))))



(defn dir-properties
  "Return properties of directory"

      (new-directory-resource f {})
      (new-file-resource f {})
      )))


