The REST service is currently embedding every BINARY value found in any properties of a node (see our documentation). The result can be (disastrously) large JSON documents and out of memory errors.
Instead, the service should check the size of the BINARY value and, if perhaps above the "large values" size, insert into the JSON document a URL which can be used to directly stream the BINARY content. Note that the URL to a BINARY value probably needs to be encoded differently in the JSON document than would a regular STRING property value that happens to be a URL. Perhaps instead of appending "/base64" to the property name, we could append "/url"?
The REST client would need to be modified to check for the URL value and, when needed, resolve it to obtain the value.
Note that this solution does not address the PUT/POST of new or updated content. So the solution will also need something that will likely need to work with a multi-part upload mechanism.