Skip to content

Instantly share code, notes, and snippets.

@teivah
Created May 30, 2018 13:28
Show Gist options
  • Save teivah/4b584dbc0c4bce37dfad55ae5b6e8fee to your computer and use it in GitHub Desktop.
Save teivah/4b584dbc0c4bce37dfad55ae5b6e8fee to your computer and use it in GitHub Desktop.
res -> {
if (res.succeeded()) {
byte[] bytes = (byte[]) res.result();
response.putHeader("Content-Type", "application/octet-stream");
response.setChunked(true);
response.write(Buffer.buffer(bytes));
response.setStatusCode(200);
response.end();
} else {
response.setStatusCode(500);
response.setStatusMessage("Internal error: " + res.cause().getMessage());
response.end();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment