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

@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 6.4.0 to 6.5.0

.gitattributes

21

index.js
'use strict'
const zlib = require('node:zlib')
const { inherits, format } = require('node:util')
const fp = require('fastify-plugin')
const zlib = require('zlib')
const encodingNegotiator = require('@fastify/accept-negotiator')
const pump = require('pump')

@@ -11,4 +14,2 @@ const mimedb = require('mime-db')

const pumpify = require('pumpify')
const encodingNegotiator = require('@fastify/accept-negotiator')
const { inherits, format } = require('util')

@@ -54,3 +55,3 @@ const { isStream, isGzip, isDeflate } = require('./lib/utils')

// If route config.compress has been set it takes precedence over compress
if (routeOptions.config && typeof routeOptions.config.compress !== 'undefined') {
if (routeOptions.config?.compress !== undefined) {
routeOptions.compress = routeOptions.config.compress

@@ -60,3 +61,3 @@ }

// Manage compression options
if (typeof routeOptions.compress !== 'undefined') {
if (routeOptions.compress !== undefined) {
if (typeof routeOptions.compress === 'object') {

@@ -85,3 +86,3 @@ const mergedCompressParams = Object.assign(

// If route config.decompress has been set it takes precedence over compress
if (routeOptions.config && typeof routeOptions.config.decompress !== 'undefined') {
if (routeOptions.config?.decompress !== undefined) {
routeOptions.decompress = routeOptions.config.decompress

@@ -91,3 +92,3 @@ }

// Manage decompression options
if (typeof routeOptions.decompress !== 'undefined') {
if (routeOptions.decompress !== undefined) {
if (typeof routeOptions.decompress === 'object') {

@@ -115,3 +116,3 @@ // if the current endpoint has a custom compress configuration ...

const defaultCompressibleTypes = /^text\/(?!event-stream)|(\+|\/)json(;|$)|(\+|\/)text(;|$)|(\+|\/)xml(;|$)|octet-stream(;|$)/
const defaultCompressibleTypes = /^text\/(?!event-stream)|(?:\+|\/)json(?:;|$)|(?:\+|\/)text(?:;|$)|(?:\+|\/)xml(?:;|$)|octet-stream(?:;|$)/u

@@ -461,2 +462,4 @@ function processCompressParams (opts) {

const gzipAlias = /\*|x-gzip/gu
function getEncodingHeader (encodings, request) {

@@ -469,3 +472,3 @@ let header = request.headers['accept-encoding']

// ref.: [HTTP/1.1 RFC 7230 section 4.2.3](https://datatracker.ietf.org/doc/html/rfc7230#section-4.2.3)
.replace(/\*|x-gzip/g, 'gzip')
.replace(gzipAlias, 'gzip')
return encodingNegotiator.negotiate(header, encodings)

@@ -472,0 +475,0 @@ } else {

{
"name": "@fastify/compress",
"version": "6.4.0",
"version": "6.5.0",
"description": "Fastify compression utils",
"main": "index.js",
"type": "commonjs",
"types": "types/index.d.ts",
"dependencies": {
"@fastify/accept-negotiator": "^1.0.0",
"fastify-plugin": "^4.0.0",
"@fastify/accept-negotiator": "^1.1.0",
"fastify-plugin": "^4.5.0",
"into-stream": "^6.0.0",
"mime-db": "^1.51.0",
"minipass": "^6.0.0",
"mime-db": "^1.52.0",
"minipass": "^7.0.2",
"peek-stream": "^1.1.3",

@@ -19,25 +20,22 @@ "pump": "^3.0.0",

"@fastify/pre-commit": "^2.0.2",
"@types/node": "^20.1.0",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"adm-zip": "^0.5.9",
"fastify": "^4.0.0-rc.2",
"@types/node": "^20.4.2",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"adm-zip": "^0.5.10",
"fastify": "^4.19.2",
"jsonstream": "^1.0.3",
"standard": "^17.0.0",
"tap": "^16.0.0",
"tsd": "^0.28.0",
"typescript": "^5.0.2"
"standard": "^17.1.0",
"tap": "^16.3.7",
"tsd": "^0.29.0",
"typescript": "^5.1.6"
},
"scripts": {
"coverage": "npm run unit -- --cov",
"coverage-report": "npm run coverage -- --coverage-report=lcov",
"coverage": "npm run test:unit -- --coverage-report=html",
"lint": "standard",
"lint:fix": "npm run lint -- --fix",
"lint:typescript": "npm run lint:fix -- --parser @typescript-eslint/parser --plugin typescript test/types/*.ts",
"lint:types": "npm run lint:fix -- --parser @typescript-eslint/parser --plugin typescript *.d.ts",
"test": "npm run lint && npm run unit && npm run test:typescript",
"lint:fix:typescript": "npm run lint:fix -- --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin \"**/*.d.ts\"",
"test": "npm run test:unit && npm run test:typescript",
"test:typescript": "tsd",
"unit": "tap -J test/*.test.js",
"unit:report": "npm run unit -- --cov --coverage-report=html",
"unit:verbose": "npm run unit -- -Rspec"
"test:unit": "tap",
"test:unit:verbose": "npm run test:unit -- -Rspec"
},

@@ -44,0 +42,0 @@ "keywords": [

'use strict'
const { test } = require('tap')
const { createReadStream } = require('fs')
const path = require('path')
const zlib = require('zlib')
const { createReadStream } = require('node:fs')
const path = require('node:path')
const zlib = require('node:zlib')
const pump = require('pump')

@@ -8,0 +8,0 @@ const Fastify = require('fastify')

'use strict'
const { test } = require('tap')
const { createReadStream, readFile, readFileSync } = require('fs')
const zlib = require('zlib')
const { createReadStream, readFile, readFileSync } = require('node:fs')
const zlib = require('node:zlib')
const Fastify = require('fastify')

@@ -7,0 +7,0 @@ const compressPlugin = require('../index')

'use strict'
const { test } = require('tap')
const { createReadStream } = require('fs')
const path = require('path')
const zlib = require('zlib')
const { createReadStream } = require('node:fs')
const path = require('node:path')
const zlib = require('node:zlib')
const pump = require('pump')

@@ -8,0 +8,0 @@ const Fastify = require('fastify')

'use strict'
const { createReadStream } = require('fs')
const { Socket } = require('net')
const { Duplex, PassThrough, Readable, Stream, Transform, Writable } = require('stream')
const { createReadStream } = require('node:fs')
const { Socket } = require('node:net')
const { Duplex, PassThrough, Readable, Stream, Transform, Writable } = require('node:stream')
const { test } = require('tap')

@@ -7,0 +7,0 @@ const { isStream, isDeflate, isGzip } = require('../lib/utils')

Sorry, the diff of this file is not supported yet

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