Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access the onprogress function for an XHR request #82

Closed
NervosaX opened this issue Jun 30, 2015 · 15 comments
Closed

Access the onprogress function for an XHR request #82

NervosaX opened this issue Jun 30, 2015 · 15 comments

Comments

@NervosaX
Copy link

I need to be able to show progress when downloading a zip file (which can be very large,
so it's really necessary). Currently there is no way to access this functionality in axios.

Example as an xhr request:

var xhr = new XMLHttpRequest();
xhr.responseType = "arraybuffer";

xhr.open("GET", "/url/here/foo.zip", true);

xhr.onprogress = function(e) {
    if (this.status === 200) {
        var curLoadedMB = (e.loaded / 1024.0 / 1024.0).toFixed(2);
        var totalMB = (e.total / 1024.0 / 1024.0).toFixed(2);
        downloadProgress.setProgress((e.loaded / e.total) * 100);
    }
};

xhr.onreadystatechange = function() {
    // ...
}

xhr.send();

Example possible use in axios:

axios({
    url: "/url/here/foo.zip",
    responseType: "arraybuffer",
    progress: function(loaded, total) {
        // ...
    }
});
@wuct
Copy link

wuct commented Jul 6, 2015

+1 for this feature

@orafaelfragoso
Copy link

+1

1 similar comment
@pandaiolo
Copy link

+1

@srph
Copy link

srph commented Jul 26, 2015

Anybody making any progress?

@willdady
Copy link

+1

2 similar comments
@SZEth8
Copy link

SZEth8 commented Sep 4, 2015

+1

@Celsius273
Copy link

+1

@NervosaX
Copy link
Author

@mzabriskie Is this ticket going to be addressed? Not being able to show progress on the front end is pretty debilitating.

@srph
Copy link

srph commented Oct 13, 2015

Yes, he even closed a few tickets related to the issue (and referred this). I don't mean to say anything, but I think a rather polite way to say that is by sending a PR 😄.

@NervosaX
Copy link
Author

@srph Yeah, there's one listed above that's been open since July.

Edit: Sorry, don't meant to sound rude. Just don't want this getting forgotten.

@soluml
Copy link

soluml commented Nov 9, 2015

+1

2 similar comments
@IDontEatSoap
Copy link

+1

@liuq
Copy link

liuq commented Nov 14, 2015

+1

@srph
Copy link

srph commented Nov 14, 2015

+1 doesn't help out here. Check out #96

@chrisfinch
Copy link

Any progress here?

@mzabriskie mzabriskie changed the title Access the onprogress function for an XHR request Access the onprogress function for an XHR request Mar 6, 2016
@axios axios locked and limited conversation to collaborators May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests