Skip to content

Instantly share code, notes, and snippets.

@tschaub
Created June 26, 2010 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tschaub/454341 to your computer and use it in GitHub Desktop.
Save tschaub/454341 to your computer and use it in GitHub Desktop.
var ByteArray = require("binary").ByteArray;
var Stream = require("io").Stream;
exports.app = function(env) {
var stream = new Stream(new java.io.ByteArrayOutputStream());
// map defined elsewhere
map.render({
imageType: "png",
output: stream
});
var body = new ByteArray(stream.unwrap().toByteArray());
return {
status: 200,
headers: {"Content-Type": "image/png"},
body: [body]
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment