Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@directus/pressure

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@directus/pressure

Pressure based rate limiter

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
increased by6.14%
Maintainers
2
Weekly downloads
 
Created
Source

@directus/pressure

Pressure based rate limiter

Description

This package exports a pressure based rate limiter that is used within Directus, an open-source headless CMS.

For more information about Directus, visit the official website.

Installation

npm install @directus/pressure

Usage

Standalone

The pressure monitor is a class that can be used anywhere:

import { PressureMonitor } from '@directus/pressure';

const monitor = new PressureMonitor({
	maxEventLoopUtilization: 0.8,
});

monitor.overloaded; // true | false

Express

The library also exports an express middleware that can be used to throw an Error when the pressure monitor reports overloaded:

import express from 'express';
import { handlePressure } from '@directus/pressure';

const app = express();

app.use(
	handlePressure({
		maxEventLoopUtilization: 0.8,
	})
);

License

This package is licensed under the MIT License. See the LICENSE file for more information.

Additional Resources

FAQs

Package last updated on 25 Jul 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc