ibrod83 / nodejs-file-downloader

130 stars 23 forks source link

`onProgress` `percentage` type wrong #68

Open vincerubinetti opened 3 months ago

vincerubinetti commented 3 months ago

The type definition says percentage is a string, but it can also be NaN, so the type should be string | number.

On a related note, I find it weird that percent is a toFixed-stringified version of the number rather than just a number. This would make the type more consistently and expectedly just number. Also I find it a little unexpected that the range of it is 0 to 100 instead of 0 to 1, but that's more of a preference.

If you ever making a breaking change to this library, these changes would be welcome.

ibrod83 commented 3 months ago

You're right, that was some stupid misunderstanding on my part. As you said, this is breaking change, so perhaps in the future