This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git


The following commit(s) were added to refs/heads/main by this push:
     new 6f1a750  Cross-links info on getting attachments with their document 
(#299)
6f1a750 is described below

commit 6f1a750db2db618e2c5f9ff2948b27b0b28477e1
Author: Doug Reeder <[email protected]>
AuthorDate: Mon Jun 13 08:40:22 2022 -0400

    Cross-links info on getting attachments with their document (#299)
---
 README.md | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index cad02d2..db31c97 100644
--- a/README.md
+++ b/README.md
@@ -545,12 +545,20 @@ Gets a document from CouchDB whose `_id` is `docname`:
 const doc = await alice.get('rabbit')
 ```
 
-or with optional query string `params`:
+or with optional [query string 
`params`](https://docs.couchdb.org/en/stable/api/document/common.html#get--db-docid):
 
 ```js
 const doc = await alice.get('rabbit', { revs_info: true })
 ```
 
+If you pass `attachments=true`, the `doc._attachments.attachmentNameN.data` 
fields will contain the 
+[base-64 encoded 
attachments](https://docs.couchdb.org/en/stable/json-structure.html#document-with-attachments).
+Or, you can use 
[`db.multipart.get`](https://github.com/DougReeder/couchdb-nano#dbmultipartgetdocname-params-callback)
+and parse the returned buffer to get the document and attachments.
+
+See the [attachments 
methods](https://github.com/apache/couchdb-nano#attachments-functions) to 
retrieve
+*just* an attachment.
+
 ### db.head(docname, [callback])
 
 Same as `get` but lightweight version that returns headers only:
@@ -957,7 +965,7 @@ fs.readFile('rabbit.png', (err, data) => {
 
 ### db.multipart.get(docname, [params], [callback])
 
-Get `docname` together with its attachments via `multipart/related` request 
with optional query string additions `params`. The multipart response body is a 
`Buffer`.
+Get `docname` together with its attachments via `multipart/related` request 
with optional [query string 
additions](https://docs.couchdb.org/en/stable/api/document/common.html#get--db-docid).
 The multipart response body is a `Buffer`.
 
 ```js
 const response = await alice.multipart.get('rabbit')

Reply via email to