{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4417","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4417/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4417/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4417/events","html_url":"https://github.com/pouchdb/pouchdb/issues/4417","id":109900463,"number":4417,"title":"rendering from blob versus live stream","user":{"login":"MarioVanDenEijnde","id":12608918,"avatar_url":"https://avatars.githubusercontent.com/u/12608918?v=3","gravatar_id":"","url":"https://api.github.com/users/MarioVanDenEijnde","html_url":"https://github.com/MarioVanDenEijnde","followers_url":"https://api.github.com/users/MarioVanDenEijnde/followers","following_url":"https://api.github.com/users/MarioVanDenEijnde/following{/other_user}","gists_url":"https://api.github.com/users/MarioVanDenEijnde/gists{/gist_id}","starred_url":"https://api.github.com/users/MarioVanDenEijnde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarioVanDenEijnde/subscriptions","organizations_url":"https://api.github.com/users/MarioVanDenEijnde/orgs","repos_url":"https://api.github.com/users/MarioVanDenEijnde/repos","events_url":"https://api.github.com/users/MarioVanDenEijnde/events{/privacy}","received_events_url":"https://api.github.com/users/MarioVanDenEijnde/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-10-05T22:36:01Z","updated_at":"2015-10-06T23:43:38Z","closed_at":"2015-10-06T00:27:19Z","body":"Hello PouchDb team,\r\n\r\nTest case iPhone:\r\nWe save an image as blob attachment in local PouchDb.\r\nFrom the local dataBase we render it on the mobile.\r\nWe experience that this takes longer then render from a live stream.\r\n\r\nThe blob is created from the live stream and thus use the same sizes.\r\n\r\nWe use the \"blobUtil.imgSrcToBlob\" to store the image.\r\nAnd we use the following code to read from the local store:\r\n```\r\n.then(function (doc) {\r\n\tconsole.log(\"1\");\r\n\tconsole.log(doc);\r\n\treturn db.getAttachment('TtPicture', 'TtPicture.png');\r\n})\r\n.then(function (blob) {\r\nconsole.log(\"2\");\r\n\tvar url = URL.createObjectURL(blob);\r\n\tvar img = document.getElementById('DidYouKnowPictureUrlImg');\r\n\timg.src = url;\r\n```\r\nCan you advise if we have to live with it? Or should I use a different approach.\r\n\r\nKind regards,\r\nMario"},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/146035571","html_url":"https://github.com/pouchdb/pouchdb/issues/4417#issuecomment-146035571","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4417","id":146035571,"user":{"login":"nolanlawson","id":283842,"avatar_url":"https://avatars.githubusercontent.com/u/283842?v=3","gravatar_id":"","url":"https://api.github.com/users/nolanlawson","html_url":"https://github.com/nolanlawson","followers_url":"https://api.github.com/users/nolanlawson/followers","following_url":"https://api.github.com/users/nolanlawson/following{/other_user}","gists_url":"https://api.github.com/users/nolanlawson/gists{/gist_id}","starred_url":"https://api.github.com/users/nolanlawson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nolanlawson/subscriptions","organizations_url":"https://api.github.com/users/nolanlawson/orgs","repos_url":"https://api.github.com/users/nolanlawson/repos","events_url":"https://api.github.com/users/nolanlawson/events{/privacy}","received_events_url":"https://api.github.com/users/nolanlawson/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T23:43:38Z","updated_at":"2015-10-06T23:43:38Z","body":"So yeah, fetching a Blob from PouchDB is always going to be slower than having it in-memory. What I mean by \"load into memory\" is simply \"read it out of PouchDB,\" which you are doing.\r\n\r\nAnother way to make your operation faster is to use `getAttachment()` instead of `get()` with `{attachment: true}`, or to add `{binary: true}`. Typically PouchDB works faster if you pull out Blobs directly instead of pulling out base64 strings and then converting them into Blobs."}}