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: 3
Registered: ‎10-25-2012
My Device: PlayBook
My Carrier: No Carrier
Accepted Solution

How to read top 200 bytes of a file

I have to read top n bytes of a set of very big files in the system in my WebWorks app but I don't know how to implement it. Please help me.



Posts: 6
Registered: ‎10-08-2012
My Device: developer
My Carrier: Telus

Re: How to read top 200 bytes of a file

Hi huydq5000, 


Using the FileReader you can use the function called readAsBinaryString(blob)


Suppose you had a File object named file and a FileReader object named reader.

You can use file.slice(startByte, endByte) to obtain a Blob chunk of your File object, in your case it would be something like:


reader.readAsBinaryString(file.slice(0, n));


Take a look at the "Slicing a File" section in this link: