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

New Contributor
Posts: 5
Registered: ‎09-15-2011
My Device: Playbook
My Carrier: Vodacom

Blob to string error


I am trying to convert a file to a Stringcurrently i open the file 

blackberry.io.file.readFile(filePath, readFile);

and tell it to pass the data to a readFile function 


function readFile(filePath, data) {

alert("Start of request");
var fileAsBase64String = blackberry.utils.blobToString(data);
type: "POST",
url: "",
data: "type=picture&data="+fileAsBase64String
}).done(function( msg ) {
alert( "Data Saved: " + msg );
}catch(e) {
alert("Error " + e);



But i keep on getting the following error when i try and convert it to a String/base64string:

TypeError: Result of expression 'blackberry.utils.blobToString' [undifined] is not a function.


and this is my config file:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" version="">
<content src="index.html"/>
<icon src="icon.png"/>
<rimSmiley Surprisedrientation mode="landscape" />
<access uri="http://XXXXXXXXXXX"/>
<access uri=""/>
<feature id="blackberry.system" />
<feature id="blackberry.media.camera" />
<feature id="blackberry.ui.dialog" />
<feature id="blackberry.io.dir" />
<feature id="blackberry.io.file" />
<feature id="blackberry.utils"  />
<rimSmiley Tongueermissions>
<rimSmiley Tongueermit>use_camera</rimSmiley Tongueermit>
<rimSmiley Tongueermit>access_shared</rimSmiley Tongueermit>
</rimSmiley Tongueermissions>


anyone know what i am doing wrong?

The file does exsit but as soon as i try and convert it i get this error.

I am testing this on my blackberry playbook.

The SDK i am using is BlackBerry WebWorks SDK for TabletOS

New Contributor
Posts: 5
Registered: ‎09-15-2011
My Device: Playbook
My Carrier: Vodacom

Re: Blob to string error

Found out my SDK did not include it... i needed 2.2 was running the 2.1.6 SDK for tablet os webworks lol 


The blackberry.utils API now includes support for blobToString and stringToBlob functions.