You are not logged in.
Pages: 1
Hi,
What is the best way in mORMot to return blob data from a Rest service?
The clients will be either Delphi or Ajax and once the data has been received they will store the blob data as a file. On the server side I have the data in a TStream or in a DB field.
My current idea is to use RawByteString like this:
procedure GetBlobData(const DataID: Integer; out FileName: string; out Data: RawByteString);
If possible I would also like to compress the data in a way that both client types can handle, but I have no idea how to do that....
Pointers are welcome :-)
br Lars
Offline
Please see "Custom returned content" paragraph in the latest SAD 1.18 pdf.
It is always a good idea to check out the latest version of the documentation first.
In short, you use a TServiceCustomAnswer function result, which allows to return any content, including BLOB.
This solution will be perfectly RESTful - you can even assign this URI to an image object in the HTML DOM.
Offline
Pages: 1