function getBlobs(fileList) {
console.log("starting to fetch blobs");
$.each(fileList, function (i, val) {
var path = baseURL + val.path;
$xhr.ajax({
url: path,
dataType: "blob",
success: function (data) { saveBlob(data, val.size, val.id); }
});
});
}
function putBlob(blob, id) { //don't worry is always a unique string
var cnt;
var type = blob.type; //for now the type is always 'image/png'
DB.putAttachment(id, blob, type, function (err, response) {
if (err) {
console.error("Could store blob: error: " + err.error + " reason: " + err.reason + " status: " + err.status);
} else {
console.log("saved: ", response.id + " rev: " + response.rev);
showID = response.id;
cnt = vm.get("blobCount");
vm.set("blobCount", ++cnt);
if (cnt == manifest.files.length) {
setTimeout(storeComplete, 0);
}
}
});
}
function setImage() {
var id = showID;
var blob;
DB.getAttachment(id, function (err, response) {
if (err) {
console.error("Could find blob: error: " + err.error + " reason: " + err.reason + " status: " + err.status);
} else {
blob = response._attachments;
var imgURL = URL.createObjectURL(blob);
// Set img src to ObjectURL
$("#imgTile").attr("src", imgURL);
// Revoking ObjectURL
URL.revokeObjectURL(imgURL);
}
});
}
Oh yes, I looked at issue #730, and I tried doing createObjectURL() for the entire response (though I don't see how that would work). And it did not work for me:
https://github.com/daleharvey/pouchdb/issues/730
To view this discussion on the web visit https://groups.google.com/d/msgid/pouchdb/bda21bd4-0f38-48f2-b092-cd193f094a25%40googlegroups.com?hl=en.
--
You received this message because you are subscribed to the Google Groups "PouchDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pouchdb+u...@googlegroups.com.
To post to this group, send email to pou...@googlegroups.com.
Besides, a few months ago I created a native IndexedDB for binary blob storage. Works great in IE10, FF, and Chrome (well,for Chrome I used the FileSystem as a polyfill). This works great. Now I am told that PouchDB supports binary blob attachments. I understand Dale is interested in seeing this work. I am also.
I suspect it is just something in the PouchDB API I do not understand. But if it takes more than that, I am willing to spend time, and create CodePen.io demos help figure this one out. (i.e. I am motivated, and funded to make help make PouchDB work for binary blobs).
--
You received this message because you are subscribed to the Google Groups "PouchDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pouchdb+u...@googlegroups.com.
To post to this group, send email to pou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pouchdb/87d19b6b-447c-4266-9f9a-8eecfe36aac0%40googlegroups.com?hl=en.
To view this discussion on the web visit https://groups.google.com/d/msgid/pouchdb/519E23B3.2010605%40netzmerk.com?hl=en.
You can create attachments without previously creating the document (the empty doc will be auto created)
https://github.com/daleharvey/pouchdb/blob/master/tests/test.attachments.js#L170
Before Pressing the button "Download Tiles" Check to see that the manifest has been stored in the DB, and that 171 tiles are present. If you already ran the test then your PouchDB is going to already have tiles in the DB, and you will get errors. In that case, Press Delete DB, and then reload the page.
When you press "Download Tiles" The following steps occur:
Right now Chrome is running fine. Firefox is very slow. I found this out a few months when I did a native IndexedDB API. So I don't think this is a PouchDB issue. Probably more due to FireFox using SQLlite which is a relational approach to a no-SQL DB.
IE10 is not working. This is sad, since my prior tests with IE10 shows it has a fantastically fast IndexedDB solution: http://stackoverflow.com/questions/14113278/storing-image-data-for-offline-web-application-client-side-storage-database
--
You received this message because you are subscribed to the Google Groups "PouchDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pouchdb+u...@googlegroups.com.
To post to this group, send email to pou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pouchdb/60c1d160-81f8-469a-ad2f-a395a0d091d0%40googlegroups.com?hl=en.
@piranna: IDB should support anything covered by the Structured Clone algorithm. So once I get this feature in, it will support Blobs, Files, and FileLists. It will not support FileEntry or DirEntry; it's not clear what exactly that would mean w.r.t. permissions, file lifetimes, etc., and the FileSystem spec isn't likely to see a lot of further development in the near term.
Any suggestions for me to get IE 10 Working?
For example, should I convert the blob to an ArrayBuffer, and then store the ArrayBuffer in PouchDB?
Or do I have to convert the blob to a Base64 string and then store it in PouchDB?
In either case, I will have to convert it back to a blob after I fetch it from PouchDB