couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Prieser <>
Subject deliver attachment in show function?
Date Fri, 28 May 2010 10:58:44 GMT

is it possible to deliver an attachment through a show function?
i've tried this with no success:

function (doc, req) {
	if (doc.type == "image" && == "online") {
		return {
			body: doc._attachments["filename"].data,
			headers: { "content-type" : doc._attachments["filename"].content_type}
	else {
		return 'not found or offline';

Reason is to rewrite this URL in varnish cache and only deliver images 
which are flagged online in
My application would ask for http://varnish/image/<imagedocid> and only 
get online images.
I'm trying to avoid an extra http roundtrip through the application server.

any ideas how to accomplish this scenario?

jan prieser

View raw message