Skip to content
Middleware for Connect that can serve attachments from CouchDB documents.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Connect middleware that serves document attachments from CouchDB.


Consider the following code:

var couchdbAttachments = require('couchdb-attachments');
app.use(couchdbAttachments({database: 'users', prefix: 'users/images'}));

When a request arrives for /users/images/foo/56/profile.jpg, this middleware will look for an attachment called profile.jpg, on the document with _id 56, in the database users.



Configure with a single argument, which is an object containing options.

Possible options:

  • database, the name of the database load attachments from.
  • prefix, the prefix of the external path to respond to.
  • connectionOptions, any additional connection options to pass to cradle.
Something went wrong with that request. Please try again.