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

fastify-static

Package Overview
Dependencies
Maintainers
14
Versions
55
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 4.2.4 to 4.3.0

2

index.d.ts

@@ -10,2 +10,4 @@ // Definitions by: Jannik <https://github.com/jannikkeye>

sendFile(filename: string, rootPath?: string): FastifyReply;
sendFile(filename: string, options?: SendOptions): FastifyReply;
sendFile(filename: string, rootPath?: string, options?: SendOptions): FastifyReply;
download(filepath: string, options?: SendOptions): FastifyReply;

@@ -12,0 +14,0 @@ download(filepath: string, filename?: string): FastifyReply;

8

index.js

@@ -235,3 +235,5 @@ 'use strict'

if (opts.decorateReply !== false) {
fastify.decorateReply('sendFile', function (filePath, rootPath) {
fastify.decorateReply('sendFile', function (filePath, rootPath, options) {
const opts = typeof rootPath === 'object' ? rootPath : options
const root = typeof rootPath === 'string' ? rootPath : opts && opts.root
pumpSendToReply(

@@ -241,3 +243,5 @@ this.request,

filePath,
rootPath || sendOptions.root
root || sendOptions.root,
0,
opts
)

@@ -244,0 +248,0 @@ return this

{
"name": "fastify-static",
"version": "4.2.4",
"version": "4.3.0",
"description": "Plugin for serving static files as fast as possible.",

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

@@ -36,2 +36,5 @@ # fastify-static

fastify.get('/another/path', function (req, reply) {
return reply.sendFile('myHtml.html', { cacheControl: false }) // overriding the options disabling cache-control headers
})
```

@@ -38,0 +41,0 @@

@@ -74,2 +74,10 @@ import fastify from 'fastify'

multiRootAppWithImplicitHttp.get('/', (request, reply) => {
reply.sendFile('some-file-name', { cacheControl: false, acceptRanges: true })
})
multiRootAppWithImplicitHttp.get('/', (request, reply) => {
reply.sendFile('some-file-name', 'some-root-name', { cacheControl: false, acceptRanges: true })
})
multiRootAppWithImplicitHttp.get('/download', (request, reply) => {

@@ -76,0 +84,0 @@ reply.download('some-file-name')

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