peterkhayes/rolling-rate-limiter

Get how many requests left

alexmccabe opened this issue · 2 comments

Is there a way to get how many tokens the requesting IP address has left? I can see that it returns the timeLeft, but it would be useful to get the tokens too.

There isn't currently, but I'd be open to a PR if you'd like to. Probably just stick another method on the main rate limiter function.

There is a new version of this library out. You can see the release notes here. It includes this functionality through the limitWithInfo or wouldLimitWithInfo methods.