Socket
Socket
Sign inDemoInstall

fastify-static

Package Overview
Dependencies
19
Maintainers
6
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 0.7.0

27

index.js

@@ -34,17 +34,13 @@ 'use strict'

function pumpSendToReply (request, reply, pathname) {
const sendStream = send(request.req, pathname, sendOptions)
const stream = send(request.req, pathname, sendOptions)
// this is needed because fastify automatically
// set the type to application/octet-stream
stream.on('headers', removeType)
if (setHeaders !== undefined) {
sendStream.on('headers', setHeaders)
stream.on('headers', setHeaders)
}
sendStream.on('error', function (err) {
if (err.status === 404) {
reply.notFound()
} else {
reply.send(err)
}
})
sendStream.pipe(reply.res)
reply.send(stream)
}

@@ -94,2 +90,9 @@

module.exports = fp(fastifyStatic, '>= 0.38.0')
function removeType (res) {
res.setHeader('Content-Type', '')
}
module.exports = fp(fastifyStatic, {
fastify: '>= 0.42.0',
name: 'fastify-static'
})
{
"name": "fastify-static",
"version": "0.6.0",
"version": "0.7.0",
"description": "Plugin for serving static files as fast as possible.",

@@ -33,3 +33,3 @@ "main": "index.js",

"coveralls": "^3.0.0",
"fastify": "^0.38.0",
"fastify": "^0.42.0",
"pre-commit": "^1.2.2",

@@ -36,0 +36,0 @@ "proxyquire": "^1.8.0",

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

fastify.setErrorHandler(function errorHandler (err, reply) {
reply.send(err.status + ' Custom error message')
reply.type('text/plain').send(err.status + ' Custom error message')
})

@@ -312,3 +312,3 @@

fastify.setNotFoundHandler(function notFoundHandler (request, reply) {
reply.code(404).send(request.req.url + ' Not Found')
reply.code(404).type('text/plain').send(request.req.url + ' Not Found')
})

@@ -315,0 +315,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc