I use express static middleware to server static files. I also use compress middleware. My question is if express reads file from disk and compress it every time it is returned (downloaded) to client? Or maybe it caches compressed file in memory?
Yes, the static middleware will perform disk I/O.
Internally, it doesn't do much and delegates all of the work to the send dependency, which is a package specifically geared towards gracefully handling requests that resolve to responses that stream from the disk from some root.
It doesn't cache anything in memory, but it is capable of returning correct cache headers and responding with HTTP 304 responses, should you want to build something on top of that to store responses and serve them from memory.
This is about as close as you can get to perfect for most Node.js file servers, although be mindful of your particular requirements. There are other HTTP servers such as Varnish or Nginx that are more suited for advanced requirements.