
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
ratelimit-header-parser
Advanced tools
Parse RateLimit headers of various forms, including the combined form from draft 7 of the IETF standard, into a normalized format.
Parse RateLimit headers of various forms into a normalized format. Supports the
combined form from
draft 7
of the
IETF Rate Limit Headers standard,
the uncombined RateLimit-* format of earlier drafts, traditional
X-RateLimit-* headers, and a few other formats.
import { parseRateLimit } from 'ratelimit-header-parser'
const response = await fetch(
'https://api.github.com/repos/express-rate-limit/express-rate-limit/contributors?anon=1',
)
console.log('github ratelimit:', parseRateLimit(response))
// > github ratelimit: { limit: 60, used: 1, remaining: 59, reset: 2023-08-25T04:16:48.000Z }
Scans the input for ratelimit headers in a variety of formats and returns the result in a consistent format, or undefined if it fails to find any ratelimit headers.
responseOrHeadersObject: May be either a fetch-style Response or Headers
object or a node.js-style response or headers objectoptions: Optional object with the following optional fields:
reset: How to parse the reset field. If unset, the parser will guess based
on the content. Accepts the following strings:
'date': past the value to new Date(...) to let the JavaScript engine
parse it'unix': treat the value as the number of seconds since January 1, 1970
(A.K.A a unix timestamp)'seconds': treat the value as the number of seconds from the current
time'milliseconds': treat the value as the number of milliseconds from the
current timeReturns a object with the following fields, or undefined if it does not find any rate-limit headers.
{
limit: number
used: number
remaining: number
reset: Date or undefined
}
FAQs
Parse RateLimit headers of various forms, including the combined form from draft 7 of the IETF standard, into a normalized format.
The npm package ratelimit-header-parser receives a total of 400 weekly downloads. As such, ratelimit-header-parser popularity was classified as not popular.
We found that ratelimit-header-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.