Download the file in a thread

After a bit of a struggle, and with the help of a counselor I got labour code for the download of a zip file. On the ripple, the download takes about 14 seconds. I guess it takes longer on a device.

So, I definitely want to do this in seprate thred to not lock the GUI.  The code that got us to the DOM object so I can't use a thread with a 'worker '. DOM is not thread-safe.

Any suggestions anyone?

Solution.  Using XMLHttpRequest asynchronous param 'true '.

the blob value and write to the file system. The download will asynchronous and synchronous write file

The code below is a bit messy with debugging and also failure unzip code but I think the general idea is clear enough

There is a warning for 'arraybuffer' saying to use instead of 'ArrayBufferView' but 'ArrayBufferView' is not supported

var myblob;
 
Service (myURL) DL5
{
 
XHR = new XMLHttpRequest();
XHR. Open ("GET", myURL, true ");  Asynchronous.
xhr.responseType = "blob";
xhr.responseType = "arraybuffer."
xhr.responseType = "ArrayBufferView";         Not supported?
var builder = new WebKitBlobBuilder();
XHR. OnLoad = function (e)
{
     
Builder.Append (XHR. (Response);
object blob var = builder.getBlob ("config.zip");
    
myblob = new Blob ([xhr.response], {type: "zip"});

If (onSuccess)
{
onSuccess ("Download OK!");
}
};
XHR. Send();
}

function onSuccess (mess)
{
alert (mess);
DLX();
}

function DLX()
{
requestFileSystem = window.requestFileSystem | window.webkitRequestFileSystem;
BlackBerry.IO.sandbox = false;
requestFileSystem (window. PERSISTENT, 10 * 1024 * 1024, onSuccess2, onError2);
}
function onError2 (e)
{
Alert ("File system failed" + e);
}

function onSuccess2 (fs)
{
Alert ("in Success2");
fs.root.getFile (blackberry.io.home + "/ config.zip", {create: true}, {(fileEntry) function)
fileEntry.createWriter (function (f)
{
f.onwriteend = {function (event)}
Alert ("fine writing");
                
txt var = community.unzip.unzipPackage (blackberry.io.home + "/ config.zip", blackberry.io.home/+ "/ decompress");
var JSONobject = eval (txt);
                
Alert ("unzip");
};
f.OnError = {function (err)}
Alert ("error of writing");
};

f.Write (myblob);
Alert ("file saved!");
}
)
}
)
}

Tags: BlackBerry Developers

Similar Questions

  • When someone comes in! * they should be able to download the file, how can I do?

    Original title: Hello

    Hello

    people you know out

    Here I want to insert a file

    When someone enters

    ***!***

    they should be able to download the file

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace NewProject
    {
    Class Program
    {
    public static void Main (string [] args)
    {
    Console.WriteLine;
    Console.WriteLine ("How are you");
    String a1 = Convert.ToString (Console.ReadLine ();
    if (a1 == "***!***")
    {
    Console.WriteLine ("you are great");
    Console.ReadLine ();
    }
    Console.WriteLine ("what you do");
    String a2 = Convert.ToString (Console.ReadLine ();
    If (a2 == "!") *!!!")
    {
    Console.WriteLine ("you are great");
    Console.ReadLine ();
    }
    Console.WriteLine ("end");
    Console.ReadLine ();
    }
    }
    }

    Hi stevoo,

    The question you posted would be better suited in the MSDN Forums. I would recommend posting your query in the MSDN Forums.

    To contact the MSDN support, you can use the following link.
    http://social.msdn.Microsoft.com/forums/en/categories

    Hope this is useful.

  • I have the UI which downloads the file in file multiprt transfer in chuncks. It worked very well in a previous version of firefox, but now ajax calls gets abandoned?

    I have the UI which downloads the file in file multiprt transfer in chuncks (blob file). It worked very well in a previous version of firefox when we send chuncks 10 MB for each ajax calls. But now in the last version of firefox, its get rejected for 10Mo chuncks with every call, but allowing only 4 KB be sent for each call. You guys could help me. I also tried with the Application (/ octectstream). It also works very well in all browsers.

    Hi Sivasathy, support.mozilla.org is intended for management of the end user. If you have questions about web development please refer to the place to go for support the developers instead. Thank you for your understanding!

  • I can't download the file in the browser

    I have a alcatel one touch 2040d, no download link in the browser does not download the file and
    How to upgrade firefox os1.3 2.0 in my phone

    I do not think that the OneTouch 2040d working Firefox OS; It would be best if you contacted Alcatel directly.

    I hope this helps you!

  • Why my windows phone says he can not download the file type when you try to install the firefox browser?

    I have no restrictions on the phone. I tried to be sure and use the features of security as... Safe search, cookie and other block. He repeated, however, unable to download the file type when I try and install one of the browsers to date. What is interesting to say the least. Because my browser already uses the version more up-to-date. I have internet explore using a nokia windows 8

    Hello, the mobile version of firefox is not available on the windows phone platform: Firefox work on my mobile?

    There was technical and legal obstacles in the app store initially that discouraged mozilla to start any developments in this direction. I do not know the current situation, but given that mozilla is now focusing its efforts on the creation of firefox os as a platform open source web-based, I doubt you'll see firefox on your windows phone device in the foreseeable future...

  • Select and download the file to the collapsed site works on firefox 31

    On a site using CKEditor and RoxyFileman file manager to download the files, I have always used the button 'Browse' to select a file in my computer, and then you press the Upload button and work done. Updated to Firefox and now when I press the button 31 transfer window "Select the file" remains on the screen and no download.
    Last night I had a report of another user in the same site for this problem. I used the version 30 and that he had upgraded to version 31...
    Checked and no problems with Windows 7 and Windows XP with IE 11, 36 Chrome and Firefox 30 and Linux Mint 17 with Firefox 30.
    On sites with the button 'Browse' classic, there is no problem.

    Problem solved with Firefox 32!
    Now, everything works again as before...

    Thank you Mozilla team!
    I am very happy to see that you take in mind our problems and that you always support our work.
    Thanks again!

  • Where can I find and download the file "Windiag.iso" for Windows XP Home Edition?

    Where can I find and download the file "Windiag.ISO" for Windows Xp home edition?  IT TURNS OUT THAT HE MUST FIRST DOWNLOAD AND RUN A FILE NAMED 'MTINST. "EXE", AND THAT IN DOING SO, THE FILE NAMED "WINDIAG. ISO"IS CREATED.

    Hello

    You can check this link:

    http://oca.Microsoft.com/en/windiag.asp

  • Problems loading a file in SkyDrive: "sorry, SkyDrive can't download files. Please download the files that are contained in the folder instead.

    Whenever I try to add a "xlsx" to "SkyDrive" document I get the following message:

    Sorry, SkyDrive can't download files. Please download the files that are contained in the folder instead. Neither I am able to drag and drop files in skydrive folder!

    I even tried as well to load it from the Office & do slip from the "Desktop" to the "SkyDrive" - but not of joy!

    Assistance would be greatly appreciated

    > Sorry, that SkyDrive impossible to download files. Please download the files that are contained in the folder instead.

    He tells you to OPEN the file, download the files on skydrive. BUR, NOT the FOLDER itself.

    You can download several files at the same time. How many? I'm not sure. I do not have more than 2 files both myself.

    SkyDrive limited maximum 50 MB each download.

  • Could someone tell me: How can I download the file "dumppo.exe" from the Microsoft website. Please write to me at: * e-mail address is removed from the privacy *; Thanks in advance.

    I want to download the file "dumppo.exe" from the Microsoft site, but I can't find where to download it!

    No longer seems to be available.

  • Error "C:\Documents and settings\user\mydownlaods\ < download the file > is not found" after downloading a file.

    Original title: download problems

    After that I downloaded a file, it is deleted when I try to open it. I get an error that says C:\Documents and settings\user\mydownlaods\than the name of download, cannot be found.when I look in my download file, it shows the download as being deleted. Any ideas?  FF

    Welcome back, checks and please uncheck all responses as answered, this way among the other contributors will see the question and perhaps a few other ideas.

    Thank you

    EDIT:

    other things that could cause this problem:

    1.

    IE open in "no Add-ons" mode To do than go to start > all programs > Accessories > system tools > "Internet Explorer (No Add-ons). If you can download the software now, it suggests then there's a bad addition affecting the browser.

    2.

    Sometimes the index.dat file may be damaged. In this case, you will need to delete the index.dat file and restart your computer. Then, you will be able to upload files properly again. Follow the steps below to delete this file.

    (1) open Internet Explorer.

    2) click on tools, click on Internet Options

    (3) on the tab general, under temporary Internet files, click on delete files

    4) click Ok when asked if you want to remove the files

    (5) by the historical section under the general tab, click clear history, and then click Ok

    (6) close Internet Explorer

    (7) logout the current user and log on to another user as administrator account

    (8) click on start, run

    (9) type CMD and press ENTER to open a command prompt

    (10) replace the directories in the Temporary Internet Files directory by typing the following command, substituting the word by the user username and the correct drive letter in Windows XP.

    CD drive: \Documents and Settings\nom of utilisateur\Local Settings\Temporary Internet Files\Content.IE5

    Example: cd c:\Documents and Settings\Mark\Local Settings\Temporary Internet Files\Content.IE5

    (11) type del index.dat and press enter

    (12) type Exit and press ENTER to close the command prompt

    (13) restart your computer

    Once the computer has been restarted, open a web page with a link to a download. Click on the link and try to download the file. It should work now.

    Written by Mark Hasting

    3. http://support.microsoft.com/kb/932823?ppud=4&wa=wsignin1.0

  • I lost my backup for windows xp home disks and now my computer asks me for the startup disk. Is there anywhere I can download the file on a dvd?

    Windows xp starts

    I lost my backup for windows xp home disks and now my computer asks me for the startup disk.  Is there anywhere I can download the file on a dvd?

    Hi DrKathy1950,

    ·         Did you do changes on the computer before the show?

    ·         When she asks the startup disk?

    ·         You get the error message?

    ·         Are you able to boot to the desktop?

    Answer with the information required to help more.

    For reference:

    How to replace Microsoft software or hardware, order service packs and replace product manuals

  • Download the file is missing. Not asked where I would like to save file, only the 'Save' button appears

    When you download a file, I ask me where to save the file.  He asked me just to save it or not.  Then, after you save the file, I try to find the file, but it is not in the usual directories when I download files.  I tried to download from CNET.  This just started today.  Don't remember any recent downloads either.
    That's happened? It is not under My Documents to my profile or my Local Settings\Temp directory either.  I did a search for the file name, even in hidden folders.
    I am running Windows XP Home Edition.  [By today standard T - Rex, but it's the only one I use for office work, no video editing work.]

    Hi WingersMedia,

    1. What web browser do you use to download the files?
    2. Are you having a similar problem with all files or any download specific file only?
    3. Are you able to download and save files from other sites?

    I suggest that you try to download other files on the same site and check if it works.

    I suggest you check that the recording location of the file when you are prompted to save the file and check later to this place.

    Also check out the link below to put on with similar problem and check if it is useful if you are using Internet explorer as your web browser.

    http://answers.Microsoft.com/en-us/IE/Forum/IE8-windows_other/IE-7ON-downloading-files-option-to-save-asopen/9ee22c03-8fc3-4225-9bde-ee0e8e3c0fe9

  • Windows media player has encountered a problem when downloading the file. for additional assistance, click web help.

    Original title: unable to audio stream.

    Unable to audio stream, "windows media player has encountered a problem when downloading the file.  for further assistance, click web help' web help does not work, clicking web help does nothing (no response from program... a lot of negative response from me) stuck with the big pass... vista 64 bit... a lemon from the getgo... problem after problem...

    Hi Joseph,

    What is the file format of the file you are trying to download?

    This problem normally occurs when the Media player could not play the file downloaded or not supported.

    Method 1:

    Step 1: Here is the list of the formats supported by Windows Media player file:

    Information on the types of media files that supports Windows Media Player:

    http://support.Microsoft.com/kb/316992

    Note: See if the file format is in this list, if it is not there, you may need a third-party codec that can read the file.

    Step 2: For more information about codecs, see article given:

    Codecs: Frequently asked questions:

    http://Windows.Microsoft.com/en-us/Windows-Vista/codecs-frequently-asked-questions

    Warning: using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    Method 2:

    I also suggest you to run the Windows media player Fixit:

    Solve the problems of Windows Media Player video and other media or library

    http://support.Microsoft.com/mats/windows_media_player_diagnostic

    Hope this information helps.

  • I can't download the files Bank, brokerage, etc.

    I can't download files more for some reason, the Bank, brokerage or carbonite.  One got any ideas on why not and how to solve this problem?

    Hello

    1 did you receive an error message?

    2. don't you make changes to your computer?

    3. what web browser do you use to download the files?

    I suggest you to follow the links and check out them.

    Download files from the Internet: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows-Vista/downloading-files-from-the-Internet-frequently-asked-questions

    Disable the anti-virus software

    http://Windows.Microsoft.com/en-us/Windows7/disable-antivirus-software

    Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

  • Windows Vista Step By Step-reading error in downloading the files.

    Windows Vista Step By Step-reading error in download of files do I need to talk to or call? by following the instructions in the book - I get the error in the charge process down. I buoght the book with the CD to learn and I can not even begin to learn!

    Hello Enrico Cassin,.

    There is a section of the book which should be able to help with the CD that came with the book. If you look at the Table of contents, there is a section called using the CD of the book. See the section to see if they can help you.

    What kind of error do you get when you download the file?
    Did you choose to save the files on your computer, or you chose run?

    You can also contact MSPress for a replacement CD if the CD is damaged.
    Contact telephone Microsoft Press customer service: (800) MSPRESS or (800) 677-7377

    Please give more details as to what is happening and we will try to help.

    Sincerely.

    Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

Maybe you are looking for

  • Definition of Spotlight on macos Sierra

    Hello I had been using spotlight to search for words in El Capitan without any problems before. However I just upgraded to Sierra and spotlight returns no definition of the word. I did a clean install, but no changes in the light of the preferences.

  • Safekey does not appear in the browser

    Have installed Mcafee Safekey, installed everything but when I open Firefox the Safekey button must display in the browser, next to the search bar. It is not, is not as an extension. Reinstalled Firefox and Safekey, travel instructions to go to donat

  • Resize the popout video

    Hi, for when I'm doing other things at the same time as Skype call (most of the time), is possible to resize the video window popout? This is just a little bit on my screen and would be really good to double the size. B

  • Several accidents of Finder in El Capitan

    Since I installed El Capitan on my Mac mini (late 2012, i7), I've known several newspapers freezes Finder and accidents. Sometimes the Finder raise on its own, but most of the time, I have to take care of it manually. I'll paste the last report of cr

  • Trueblood series on the compurter

    Im trying to watch trueblood series on Comcast, but it gives me the error mess 6008 I went to my Start button clicked all programs a silverlight and then open this file and clicked on authorization then leave an ok, but I can not watch comcast on dem