I don't know if this will be helpful, but this is what I do using nginx and
node. It is efficient and easy.
I use nginx to upload the file and proxy the upload to node. Nginx waits
until the file is uploaded and then sends a request to node that just has
the file location on the disk. Then I use nano to attach the file to couch.
Even if you upload the file some other way, I highly recommend nano. One
nano command does the attachment ...
fs.createReadStream(filePath).pipe(nano.attachment.insert id,
attachmentName, null, ...