(checksum-file file)
Calculate a CRC32 checksum for a File.
Calculate a CRC32 checksum for a File.
(supports-extended-attributes? path)
Java's UserDefinedFileAttributes (a.k.a. extended attributes) do not support extended attributes on all platforms, notably HFS+ and APFS on macOS.
Waiting for https://bugs.openjdk.java.net/browse/JDK-8030048 to add macOS support.
Java's UserDefinedFileAttributes (a.k.a. extended attributes) do not support extended attributes on all platforms, notably HFS+ and APFS on macOS. Waiting for https://bugs.openjdk.java.net/browse/JDK-8030048 to add macOS support.
(wrap-file-etag handler)
(wrap-file-etag handler {:keys [extended-attributes?] :as options})
Calculates an ETag for a Ring response which contains a File as the body.
If extended-attributes? is true, then the File is first checked for a checksum in it's extended attributes, if it doesn't exist then it is calculated and added to the file, and returned in the ETag. This is much faster than calculating the checksum each time (which is already fast), but isn't supported on all platforms, notably macOS.
If you wish to store the checksum in extended attributes, it is recommended that you first check if the Path that you are wanting to serve files from supports it. You can use the provided supports-extended-attributes? function for this.
Calculates an ETag for a Ring response which contains a File as the body. If extended-attributes? is true, then the File is first checked for a checksum in it's extended attributes, if it doesn't exist then it is calculated and added to the file, and returned in the ETag. This is much faster than calculating the checksum each time (which is already fast), but isn't supported on all platforms, notably macOS. If you wish to store the checksum in extended attributes, it is recommended that you first check if the Path that you are wanting to serve files from supports it. You can use the provided supports-extended-attributes? function for this.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close