(with-temp-buffer
(insert-file-contents filePath)
(buffer-string))
but if you work with file contents as strings in Emacs Lisp, you are going to have a bad time, because performance of this is terrible enough for it to easily turn into a problem. So instead you insert-file-contents into the temporary buffer and then do a ton of low-level, error-prone imperative processing on the buffer contents itself using things like goto-char, search-forward, using markers etc. Most of the major emacs packages are littered with code like this, here is one random example:https://github.com/magit/magit/blob/master/lisp/magit-git.el...
It reads like fortran77 to me.