I have a PNG file on my computer that I'd like to send in a response using 
HttpServer.jl. In order to do that, the file needs to be serialized to 
UInt8[] (according to the HttpCommon.jl documentation, Response.data is a 
UInt8[] array).

   - Is there a built-in function to serialize to UInt8[]?

As a minimal example of what I'd like to accomplish:

using HttpServer
http = HttpHandler() do req::Request, res::Response
h = Dict("Content-Type" => "image/png");
    r = Response();
r.headers = imageheader;
r.data = SomeFunctionToConvertFilePathToSerializedData("C\\image.png");
r
end
server = Server(http)
run(server, 8000)

Has anyone sent images using HttpServer.jl before? If so, is this the 
correct approach?

Reply via email to