tusharmath / Multi-threaded-downloader

A http file downloader made in nodejs
MIT License
195 stars 90 forks source link

Can't stop the download #196

Open ProtocolNebula opened 5 years ago

ProtocolNebula commented 5 years ago

Hi. I'm trying to stop a download like #33 example but it don't work.

I get no error, simply don't do nothing.

The related part to this of my code:

// ...
                const downloadFromMTDFile$ = createMTDFile$.map(mtdPath).flatMap(DownloadFromMTDFile).share();
                const [{ response$, fdR$, meta$ }] = muxer.demux(downloadFromMTDFile$, 'meta$', 'fdR$', 'response$');

                response$.subscribe(response => {
                    setTimeout(() => response.destroy(), 1000) // stops the download after 1 second
                });

Is there a method to catch the ERROR CONNECTION RESET and change the timeout? It would solve my problem instead use this.

Thanks.