Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
genration
Posts: 34
Registered: ‎05-28-2011
My Device: Blackberry Playbook
My Carrier: O2

Playbook File IO API

Hello,

 

Now that the file IO functionality has been added for the playbook, I want to use it to save some data using the saveFile function here: http://www.blackberry.com/developers/docs/webworks/api/blackberry.io.file.html#.saveFile. However I have run into a problem. The APIs in the utils are not fully available yet, so getting data to a blob requires a different route. To do this, I have used a BlobBuilder a.k.a. a WebKitBlobBuilder. I have instantiated the object, appended some data as a string using the append method of BlobBuilder/WebKitBlobBuilder and then called the getBlob method to attain a Blob object. However when doing this and passing it as an argument to the saveFile function the function fails stating a general error that something is undefined (probably a missing property or something which the object does not have but is expected). Has anyone actually managed to write any data to a file using the saveFile function? If so how? After looking through the source for the webworks API here: https://github.com/blackberry/WebWorks/blob/master/api/io/src/blackberry/io/file/SaveFileFunction.ja... it appears as though I should be using blackberry.core.Blob but I do not think I have access to this object. I include the sample below:

 

function  save(filePath)

{

 

if(!window.BlobBuilder && window.WebKitBlobBuilder)

{

window.BlobBuilder = window.WebKitBlobBuilder;

}

 

var bb = new BlobBuilder();

bb.append("abc123");

 

blackberry.io.file.saveFile(filePath, bb.getBlob());


}

 

 

Please use plain text.
Developer
praveen_rajan
Posts: 163
Registered: ‎05-06-2011
My Device: Playbook
My Carrier: Not Specified

Re: Playbook File IO API

Hi,

 

The File IO API is not full configured for PlayBook. For more details please see the thread http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/WebWorks-SDK-v2-1-0-and-File-API...

 

Also for a work around you could try the article at thread http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Tutorial-for-Writing-WebWorks-Ex...

Please use plain text.
Contributor
genration
Posts: 34
Registered: ‎05-28-2011
My Device: Blackberry Playbook
My Carrier: O2

Re: Playbook File IO API

Ok thanks. I had looked at that extension. Looks like I will have to use that. Any date on when the File IO api will be finalised?
Please use plain text.