js-file-download icon indicating copy to clipboard operation
js-file-download copied to clipboard

Downloading in the background and when finished then showing on browsers

Open Aqeel-0 opened this issue 2 years ago • 2 comments

Am getting a nodejs stream file as response and am using axios to receive the file, and the using js-file-downloader to download the file. The problem is that it is being downloaded in the background, i can see it in the network tab in dev mode, and the file is completely downloaded then it's showing that the file is downloaded in chrome. How can i fix this... i have found an alternate solution but its no good, i want it to show that its downloading on the browser from the start. Thank you for your help...

`axios({

        method: 'post',
        url: '/api/download',
        data: { itag, url: search, length: size },
        responseType: 'arraybuffer', 
        

onDownloadProgress: (progressEvent) => { let percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total) setPercentage(percentCompleted) if(percentCompleted === 100 ) { setPercentage(0) setIsDownloading(false) } }

    }).then((response) => {
        console.log(response)
        fileDownload(response.data, 'video.mp4')

    });` 

Aqeel-0 avatar Sep 22 '22 19:09 Aqeel-0

I have the same problem..

trans-iesa avatar Nov 30 '22 14:11 trans-iesa

Have you find a solution for this?

harjitsinghhpk avatar Apr 19 '23 03:04 harjitsinghhpk