Hm, what im kinda thinking about is that we need a third type, atm we have only text output but no binary output like with readfile. This should be done at the very end of the request, basically somewhere before/after this https://github.com/owncloud/appframework/blob/master/app.php#L64