(defn ^String ext
"Given a file, url or string return the file extension."
[x]
(let [s (cond
(file? x) (filename x)
(url? x) (path x)
(string? x) x
:else (throw (Exception. (str "Expected file, url, or string. Got " (pr-str x)))))]
(last (string/split s #"\."))))