How to streaming delivery large binary content with ML Xquery RESTful API

MarkLogic will chunk binary content from the modules database (static content).

If the content is in the content database, you need to chunk it in your application code. There is a sample here: https://docs.marklogic.com/guide/app-dev/binaries#id_76113

Separately, and just for reference to your thoughts of it loading into memory, it may be useful to read up on the three ways binary content can be stored. The memory and cache requirements differs per approach. Just good background reading : https://docs.marklogic.com/guide/app-dev/binaries#id_93203