Socket
Socket
Sign inDemoInstall

@fastify/compress

Package Overview
Dependencies
Maintainers
20
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/compress - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1

18

index.js

@@ -112,2 +112,9 @@ 'use strict'

const defaultCompressibleTypes = /^text\/(?!event-stream)|(?:\+|\/)json(?:;|$)|(?:\+|\/)text(?:;|$)|(?:\+|\/)xml(?:;|$)|octet-stream(?:;|$)/u
const recommendedDefaultBrotliOptions = {
params: {
// Default of 4 as 11 has a heavy impact on performance.
// https://blog.cloudflare.com/this-is-brotli-from-origin#testing
[zlib.constants.BROTLI_PARAM_QUALITY]: 4
}
}

@@ -121,12 +128,9 @@ function processCompressParams (opts) {

const params = {
global: (typeof opts.global === 'boolean') ? opts.global : true,
/**
* Default of 4 as 11 has a heavy impact on performance.
* @see {@link https://blog.cloudflare.com/this-is-brotli-from-origin#testing}
*/
brotliOptions: { [zlib.constants.BROTLI_PARAM_QUALITY]: 4, ...opts.brotliOptions }
global: (typeof opts.global === 'boolean') ? opts.global : true
}
params.removeContentLengthHeader = typeof opts.removeContentLengthHeader === 'boolean' ? opts.removeContentLengthHeader : true
params.brotliOptions = opts.brotliOptions
params.brotliOptions = params.global
? { ...recommendedDefaultBrotliOptions, ...opts.brotliOptions }
: opts.brotliOptions
params.zlibOptions = opts.zlibOptions

@@ -133,0 +137,0 @@ params.onUnsupportedEncoding = opts.onUnsupportedEncoding

{
"name": "@fastify/compress",
"version": "7.0.0",
"version": "7.0.1",
"description": "Fastify compression utils",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -43,3 +43,3 @@ import fastify, { FastifyInstance } from 'fastify'

// Instanciation of an app without global
// Instantiation of an app without global
const appWithoutGlobal: FastifyInstance = fastify()

@@ -111,7 +111,7 @@ appWithoutGlobal.register(fastifyCompress, { global: false })

(err) => {
expectType<Error>(err)
expectType<Error | undefined>(err)
}
)
// Instanciation of an app that should trigger a typescript error
// Instantiation of an app that should trigger a typescript error
const appThatTriggerAnError = fastify()

@@ -118,0 +118,0 @@ expectError(appThatTriggerAnError.register(fastifyCompress, {

Sorry, the diff of this file is too big to display

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