Function: gptel--file-binary-p
gptel--file-binary-p is a natively compiled function defined in
gptel-request.el.
Signature
(gptel--file-binary-p PATH)
Documentation
Check if file at PATH is readable and binary.
Source Code
;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel-request.el
(defun gptel--file-binary-p (path)
"Check if file at PATH is readable and binary."
;; HACK Image files with ICC color profiles are characterized as ASCII
;; (#1223), so until we find a better solution we just match these files by
;; extension.
(or (string-match-p "\\.\\(jpe?g\\|png\\|gif\\|webp\\)\\'" path)
(condition-case nil
(with-temp-buffer
(insert-file-contents path nil 1 512 'replace)
(memq buffer-file-coding-system
'(no-conversion no-conversion-multibyte)))
(file-missing (message "File \"%s\" is not readable." path)
nil))))