3.0.5 • Published 5 months ago

@directus/pressure v3.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@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

2.0.3

12 months ago

2.0.5

11 months ago

2.0.4

11 months ago

3.0.4

6 months ago

3.0.3

7 months ago

3.0.2

8 months ago

3.0.1

8 months ago

3.0.5

5 months ago

3.0.0

9 months ago

2.0.2

12 months ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.22-rc.0

1 year ago

1.0.21-rc.0

1 year ago

1.0.19

1 year ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9-beta.0

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago