hgouveia / node-downloader-helper

A simple http file downloader for node.js
MIT License
253 stars 54 forks source link

When trying to retry, the old fileStream will not be closed, causing a memory leak #105

Closed mumuyu66 closed 1 year ago

mumuyu66 commented 1 year ago

Hello, I have encountered a bug. When the network is unstable, the downloader will try to reconnect. Before reconnecting, the old file stream is not closed, causing this file to be occupied all the time. This bug can be reproduced by:

  1. Download a large file
  2. Open the network immediately after closing the network (simulating network instability)
  3. After the download is complete, only call downlaoder.stop without closing the application process
  4. Try to delete the downloaded file, it will prompt that the deletion is unsuccessful

I have submitted a revised version of the code, passed the above test, please pass the review!

hgouveia commented 1 year ago

@mumuyu66 published as 2.1.8 , thanks for your contribution