How to create ResponseEntity from OutputSteam

I am using Akka HTTP 10.1.11

HttpEntities.create supports creating from File or ByteString but not from OutputStream. How to create akka.http.javadsl.model.ResponseEntity from OutputStream?

Currently I am creating as below
Source<ByteString, OutputStream> source = StreamConverters.asOutputStream().mapMaterializedValue(os -> {;// This will connect to 3rd party service, and receives file content in outputstream
return os;
ResponseEntity resposeEntity = HttpEntities.create(ContentTypes.APPLICATION_OCTET_STREAM, preAuthData.getFileSize(), source);
(ContentTypes.APPLICATION_OCTET_STREAM, fileSize, source);

However, the above is throwing exception Rendering of response failed because response entity stream materialization failed with ‘ java.util.concurrent.TimeoutException: Futures timed out after [5 seconds]’. Sending out 500 response instead. java.util.concurrent.TimeoutException: Futures timed out after [5 seconds]