The easiest method is to concatenate both contents in a single continuous buffer,
and then compress this buffer as a one-shot compression operation.
This is by far the easiest way.
Other methods exists (bufferless streaming, and full frame streaming)
but they are more complex, and come with a non trivial set of trade offs,
so I would rather not recommend to use them,
they exist mostly for experts who know what they are doing (are fully aware of the trade offs involved).