From a2aa65bba178ad6527ec068e7a56b05dddc6a520 Mon Sep 17 00:00:00 2001 From: Timothy Farrell Date: Wed, 22 Aug 2018 10:32:40 -0500 Subject: [PATCH] README fixes --- packages/pouchdb-attachmentproxy/README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/pouchdb-attachmentproxy/README.md b/packages/pouchdb-attachmentproxy/README.md index 3d7adbc..a049121 100644 --- a/packages/pouchdb-attachmentproxy/README.md +++ b/packages/pouchdb-attachmentproxy/README.md @@ -7,18 +7,23 @@ metadata without having the raw data bogging down your PouchDB database. ## Overview Attachment Proxy works by intercepting attachments bound for the pouchdb backend and passing them to -a custom `save` function that will return a sentry blob to be saved in the pouchdb document. +a custom `save` function that will return a blob to be saved in the pouchdb document. The returned +blob should be a smaller *sentry* blob with just enough information needed to fetch the full version +that is being proxied. `stringToBlob` is provided to make this process easier for simple string +identifier cases. Alternatively, you can pass the original attachment through if you do not want it +to be proxied. -When an attachment is requested, the sentry blob will be provided to a custom `getFn` function to be -converted into desired document. +When an attachment is requested, the document attached blob (returned from `save`) will be provided +to a custom `getFn` function to be converted into desired document. `blobToString` is provided to +make this easier for simple string identifier cases. Similar to `getFn`, the sentry blob is provided to `remove` when an attachment or its containing document is deleted. Each function is expected to be asynchronous and the database will not continue its operation until the proxy function completes to ensure data integrity. It may be desirable to for the `remove` -function to delay attachment cleanup. The proxy blob will be removed from document (effectively -orphaning the proxied attachment until it is cleaned). +function to delay attachment cleanup. In this case, the document blob will be removed from document +(effectively orphaning the proxied attachment until it is cleaned asynchronously). ## Example