Socket
Socket
Sign inDemoInstall

sirv

Package Overview
Dependencies
3
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.17 to 1.0.18

20

build.js

@@ -91,16 +91,22 @@ const fs = require('fs');

function isEncoding(name, type, headers) {
headers['Content-Encoding'] = type;
headers['Content-Type'] = mime.getType(name.replace(/\.([^.]*)$/, '')) || '';
}
const ENCODING = {
'.br': 'br',
'.gz': 'gzip',
};
function toHeaders(name, stats, isEtag) {
let enc = ENCODING[name.slice(-3)];
let ctype = mime.getType(name.slice(0, enc && -3)) || '';
if (ctype === 'text/html') ctype += ';charset=utf-8';
let headers = {
'Content-Length': stats.size,
'Content-Type': mime.getType(name) || '',
'Content-Type': ctype,
'Last-Modified': stats.mtime.toUTCString(),
};
if (enc) headers['Content-Encoding'] = enc;
if (isEtag) headers['ETag'] = `W/"${stats.size}-${stats.mtime.getTime()}"`;
if (/\.br$/.test(name)) isEncoding(name, 'br', headers);
if (/\.gz$/.test(name)) isEncoding(name, 'gzip', headers);
return headers;

@@ -107,0 +113,0 @@ }

{
"name": "sirv",
"version": "1.0.17",
"version": "1.0.18",
"description": "The optimized & lightweight middleware for serving requests to static assets",

@@ -5,0 +5,0 @@ "repository": "lukeed/sirv",

Sorry, the diff of this file is not supported yet

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