Posted Sat, 05 Sep 2015 03:41:20 GMT in reply to
Ozan
Reply
On Wed, 02 Sep 2015 06:04:33 GMT, Ozan wrote:
Hi
What is the recommanded way to send a file from vibe to a requesting Browser? F.ex. I habe a DB or another kind of repository, loading data from a blob and want to send it to the browser client.
Should I open a datastream or something similar, can I copy byte arrays in a http response?
Regards, Ozan
you have to convert the blob into ubyte[] send it to browser using res.writeBody(file, 200, mimetype);
if the blob contains and image, you should put the proper mimetypes...
ubyte[] file = rowset.getBytes("blob_field");
res.writeBody(file, 200, "image/jpg");
the other is save it as a file then serve as a static file
serveStaticFile(file_location)(req,res);