cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Powell (JIRA)" <>
Subject [jira] [Created] (CB-9680) Cordova File Transfer creates the empty file then stops
Date Fri, 18 Sep 2015 16:49:04 GMT
David Powell created CB-9680:

             Summary: Cordova File Transfer creates the empty file then stops
                 Key: CB-9680
             Project: Apache Cordova
          Issue Type: Bug
          Components: Plugin File Transfer
    Affects Versions: 1.2.0
         Environment: Windows 8.1 Using ngCordova
            Reporter: David Powell

I have an object with file data I generate in a function that's structured like this:

fileData[0]['location'] = "/path/to/save/to/"
fileData[0][0] = ""
fileData[1]['location'] = "/path/to/save/to/"
fileData[1][0] = ""
fileData[2]['location'] = "/path/to/save/to/"
fileData[2][0] = ""
There's about 188 in total right now.

I run a second function that I pass the object to that starts from the bottom up, extracts
the location, creates the directory, then passes data to a function to process the download.
Once the download is complete it's supposed to remove the current item from the object, send
the object back to the previous function and repeat until the object is empty.

function startDownload(fs, instlData) {
    delete instlData.__proto__;
    var currentLoc = getObjSize(instlData) - 1;
    var fileUrl = instlData[currentLoc][0];
    var fileLoc = instlData[currentLoc]['location'];

    var fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
    var filePath = fs.winpath + fileLoc + '/';

    fs.root.getDirectory("/" + fileLoc, { create: true }, function (dirEntry) {

        downloadFile(fileUrl, filePath, fileName, fs, instlData, currentLoc);

    }, function (err) { console.log(err); });

function downloadFile(fileUrl, filePath, fileName, fs, instlData, currentLoc) {

    var fileLoc = filePath + fileName;

    $, fileLoc, {}, true)
    .then(function (result) {
        delete instlData[currentLoc];
        startDownload(fs, instlData);
    }, function (err) {
        delete instlData[currentLoc];
        startDownload(fs, instlData)
    }, function (progress) {
}, false);

I'm running everything on deviceready per the docs. I've ran console.log() on the variables
and all the urls are correct.

fs.root.getDirectory("/" + fileLoc, { create: true }, function (dirEntry) creates the directory
as expected and $, fileLoc, {}, true) creates
the empty placeholder file but it's never written to. As a matter of fact, nothing happens.
No error, not process log, nothing. It doesn't even iterate to the next item... just stops.

If I provide anything that's not a URL (such as just removing "http://" from the file url)
it will iterate through all the items, create all the placeholders, and create all the directories.
Obviously the file is empty because it's not a valid url.

I even tried the test file in the ngCordova example (

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message