David
David

Reputation: 4465

how to send_data or attached file with goliath and grape?

not sure how this is done, but following how's its done in Sinatra wouldn't cut it on Goliath - How can I send binary data from Sinatra?

Upvotes: 1

Views: 640

Answers (1)

dj2
dj2

Reputation: 9618

You can set the 'Content-Type' header into the headers hash and then just send the data back, if your file is small enough.

[200, {'Content-Type' => 'application/octet-stream'}, "\x01\x02\x03"] 

If the file is large, you can do chunked streaming of the response, take a look in the examples directory of Goliath to see a couple of streaming samples.

Upvotes: 1

Related Questions