Build CouchDB documents from directory, JSON or module.
var compile = ;;
compile(directory, [options], callback)
options.multipart is true, attachments are handled as multipart.
callback is called with two arguments:
options.multipart is set,
callback is called with a third argument:
attachments. This is a multipart attachments array as required by
name: 'rabbit.png'content_type: 'image/png'data: <Buffer>
data can be a
Buffer or a
A simple commandline client is included:
npm install -g couch-compile
Give it a directory, or use the current one:
It is quite self-explanatory. For example:
myapp├── _id├── language└── views└── numbers├── map.js└── reduce.js
test/expected for usage examples.
For property names file extensions will be stripped:
"validate_doc_update": "content of validate_doc_update.js"
Files inside the
\_attachments directory are handled special:
They become attachment entries of the form
"a/file.txt":"data": "SGVsbG8gV29ybGQhCg==""content_type": "text/plain"
content\_type is computed using mime.
data is the base64 encoded value of the file.
Read more about Inline Attachments.
Run the testsuite with
(c) 2014 Johannes J. Schmidt, TF