Socket
Socket
Sign inDemoInstall

@fastify/static

Package Overview
Dependencies
Maintainers
19
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/static - npm Package Compare versions

Comparing version 6.4.1 to 6.5.0

.eslintrc

4

index.d.ts

@@ -5,3 +5,3 @@ // Definitions by: Jannik <https://github.com/jannikkeye>

import { FastifyPluginCallback, FastifyReply } from 'fastify';
import { FastifyPluginCallback, FastifyReply, FastifyRequest } from 'fastify';
import { Stats } from 'fs';

@@ -90,3 +90,3 @@

list?: boolean | ListOptionsJsonFormat | ListOptionsHtmlFormat;
allowedPath?: (pathName: string, root?: string) => boolean;
allowedPath?: (pathName: string, root: string, request: FastifyRequest) => boolean;
/**

@@ -93,0 +93,0 @@ * @description

@@ -75,3 +75,3 @@ 'use strict'

if (allowedPath && !allowedPath(pathname, options.root)) {
if (allowedPath && !allowedPath(pathname, options.root, request)) {
return reply.callNotFound()

@@ -78,0 +78,0 @@ }

{
"name": "@fastify/static",
"version": "6.4.1",
"version": "6.5.0",
"description": "Plugin for serving static files as fast as possible.",

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

@@ -14,3 +14,3 @@ # @fastify/static

`npm install --save @fastify/static`
`npm i @fastify/static`

@@ -173,5 +173,5 @@ ## Usage

Default: `(pathname, root) => true`
Default: `(pathName, root, request) => true`
This function allows filtering the served files.
This function allows filtering the served files. Also, with the help of the request object a more complex path authentication is possible.
If the function returns `true`, the file will be served.

@@ -178,0 +178,0 @@ If the function returns `false`, Fastify's 404 handler will be called.

@@ -1,2 +0,2 @@

import fastify, { FastifyInstance, FastifyPluginCallback } from 'fastify'
import fastify, { FastifyInstance, FastifyPluginCallback, FastifyRequest } from 'fastify'
import { Server } from 'http';

@@ -55,3 +55,6 @@ import { expectAssignable, expectError, expectType } from 'tsd'

},
preCompressed: false
preCompressed: false,
allowedPath: (pathName: string, root: string, request: FastifyRequest) => {
return true;
}
}

@@ -58,0 +61,0 @@

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