Start a new topic

Saving and streaming blob images

I have problems understanding the documentation on saving and streaming images.

I want to take a snapshot of my canvas, save it, link it to my collection and later stream it in html to represent a thumbnail.

to get the blob image from my canvas I use [HTMLCanvasElement.toBlob()]( "HTMLCanvasElement.toBlob()")

I am looking at this example:

var promise = Kinvey.File.upload(fileContent, {

_id : 'my-file-id',

_filename : 'my-file.txt',

mimeType : 'text/plain',

size : fileContent.length

}, {

success: function(file) {




a) Do I pass the Blob into the fileContent?

b) do I have to specify the options?

c) If I don't specify an _id, will Kinvey create and return one to me?

d) what is the file returned in the success function?

Now I want the file to be linked to my collection. I am looking at this example:

var entity = {

avatar: {

_type : 'KinveyFile',

_id : 'my-avatar-file-id'



var promise ='collection-name', entity, {

success: function(response) {




e) The _type is hardcoded constant 'KinveyFile' or should I provide the blob in there?

f) the _id is the id of the file I have uploaded, right? Does it mean that any object I save to my collection will be treated as file reference if it has properties _type='KinveyFile' and _id?

g) Next, I want to create a list of all object in my collection with thumbnails, how do I stream the file url into an image just from the collection reference?


1 Comment

Hello again Daniel,

The answers that I got from our in-house HTML-5 guy were:

A. Most likely. You can give it a try and if it doesn't work then you can try other methods.

B. we're fairly sure you do not need to specify options here, however if you do not specify options, you cannot change them later.

C. Yes

D. We're not 100% sure, but it should be fairly easy to test this on your own.

E. The type is hardcoded

F. Yes.

G. If you do a query and use the exists function ( ) you can filter on any column you enjoy. If you setup a "thumbnail" column, this will work out fine for you.

Let me know if you need anything else.

Login or Signup to post a comment