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

fastify-compression

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-compression

A compression plugin for fastify

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

fastify-compression

Greenkeeper badge Build Status Coverage Status NPM version JavaScript Style Guide

A compression plugin for Fastify. Supports gzip, deflate and brotli.

Usage

const fastify = require('fastify');
const fastifyCompression = require('fastify-compression');

const app = fastify();
app.register(fastifyCompression, {threshold: 2048});

API

compression(fastify, options, next)

Compresses the payload with gzip, brotli or deflate if the payload length is above the threshold and a Accept-Encoding header is send with the request. In case of an asterisk * in the Accept-Encoding header gzip will be chosen.

options

threshold (optional)

A number that specifies the threshold used to determine if compression should be applied. Defaults to 1024.

brotli

To enable Brotli compression pass the iltorb module with the brotli option.
Note: Since version 11.7.0 brotli is being supported by Node.js itself. Therefore the brotli option is no longer necessary.

License

MIT

Keywords

FAQs

Package last updated on 28 Jan 2019

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