Liking cljdoc? Tell your friends :D

boundary.storage.core.validation

Pure functional file validation logic.

This namespace contains no side effects - only pure functions for validating files based on size, type, extension, etc.

Pure functional file validation logic.

This namespace contains no side effects - only pure functions for validating
files based on size, type, extension, etc.
raw docstring

common-mime-typesclj

Common MIME type mappings for file extensions.

Common MIME type mappings for file extensions.
sourceraw docstring

default-max-file-sizeclj

Default maximum file size in bytes (10 MB).

Default maximum file size in bytes (10 MB).
sourceraw docstring

extension-matches-mime-type?clj

(extension-matches-mime-type? filename content-type)

Check if file extension matches the declared MIME type.

Check if file extension matches the declared MIME type.
sourceraw docstring

generate-unique-filename*clj

(generate-unique-filename* original-filename unique-suffix)

Generate a unique filename using explicit shell-supplied components.

Preserves the original extension.

Generate a unique filename using explicit shell-supplied components.

Preserves the original extension.
sourceraw docstring

get-file-extensionclj

(get-file-extension filename)

Extract file extension from filename.

Returns lowercase extension without the dot, or nil if no extension.

Extract file extension from filename.

Returns lowercase extension without the dot, or nil if no extension.
sourceraw docstring

image-mime-typesclj

Set of image MIME types.

Set of image MIME types.
sourceraw docstring

is-image-mime-type?clj

(is-image-mime-type? content-type)

Check if content type is an image MIME type.

Check if content type is an image MIME type.
sourceraw docstring

mime-type-from-extensionclj

(mime-type-from-extension filename)

Get MIME type from file extension.

Get MIME type from file extension.
sourceraw docstring

sanitize-filenameclj

(sanitize-filename filename)

Sanitize filename to remove potentially dangerous characters.

  • Removes path separators
  • Removes special characters
  • Limits length
  • Preserves extension
Sanitize filename to remove potentially dangerous characters.

- Removes path separators
- Removes special characters
- Limits length
- Preserves extension
sourceraw docstring

validate-content-typeclj

(validate-content-type content-type allowed-types)

Validate content type against allowed types.

Returns validation result map.

Validate content type against allowed types.

Returns validation result map.
sourceraw docstring

validate-extensionclj

(validate-extension filename allowed-extensions)

Validate file extension against allowed extensions.

Returns validation result map.

Validate file extension against allowed extensions.

Returns validation result map.
sourceraw docstring

validate-fileclj

(validate-file {:keys [bytes content-type size] :as _file-data}
               {:keys [filename] :as _file-metadata}
               {:keys [max-size allowed-types allowed-extensions] :as _options})

Perform comprehensive file validation.

Parameters:

  • file-data: Map with :bytes, :content-type, :size
  • file-metadata: Map with :filename
  • options: Map with :max-size, :allowed-types, :allowed-extensions

Returns validation result map with all errors if any.

Perform comprehensive file validation.

Parameters:
- file-data: Map with :bytes, :content-type, :size
- file-metadata: Map with :filename
- options: Map with :max-size, :allowed-types, :allowed-extensions

Returns validation result map with all errors if any.
sourceraw docstring

validate-file-sizeclj

(validate-file-size file-size max-size)

Validate file size against maximum allowed size.

Returns validation result map.

Validate file size against maximum allowed size.

Returns validation result map.
sourceraw docstring

validate-image-fileclj

(validate-image-file file-data file-metadata options)

Validate a file as an image with additional image-specific checks.

Returns validation result map.

Validate a file as an image with additional image-specific checks.

Returns validation result map.
sourceraw docstring

validate-image-typeclj

(validate-image-type content-type)

Validate that the file is an image based on MIME type.

Returns validation result map.

Validate that the file is an image based on MIME type.

Returns validation result map.
sourceraw docstring

validation-failureclj

(validation-failure error-message)
(validation-failure error-code error-message)
(validation-failure error-code error-message details)

Create a failed validation result with error details.

Create a failed validation result with error details.
sourceraw docstring

validation-successclj

(validation-success)
(validation-success data)

Create a successful validation result.

Create a successful validation result.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close