Creating custom route which will return an image with proper mime header

Hello hard workers

I am trying to find a solution for an end point I am interested in adding to one of my strapi backends
In this endpoint I would like to return an image as a stream
I created a custom route and a controller to handle it.
is it possible to return an image stream from the controller and change it’s headers to be image/jpeg ?


Found in Koa documentation the way to set the headers
basically it is using the ctx object and a pretty weird syntax like so
ctx.set('content-type', 'image/jpeg');