serve-favicon
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -0,1 +1,6 @@ | ||
2.0.1 / 2014-06-05 | ||
================== | ||
* Reduce byte size of `ETag` header | ||
2.0.0 / 2014-05-02 | ||
@@ -2,0 +7,0 @@ ================== |
24
index.js
/*! | ||
* Expressjs | Connect - serve-favicon | ||
* serve-favicon | ||
* Copyright(c) 2010 Sencha Inc. | ||
@@ -48,4 +48,2 @@ * Copyright(c) 2011 TJ Holowaychuk | ||
stat = fs.statSync(path); | ||
if (!stat) throw createNoExistsError(path); | ||
if (stat.isDirectory()) throw createIsDirError(path); | ||
@@ -83,3 +81,3 @@ } else { | ||
'Cache-Control': 'public, max-age=' + ~~(maxAge / 1000), | ||
'etag': '"' + md5(buf) + '"' | ||
'etag': etag(buf) | ||
} | ||
@@ -98,16 +96,8 @@ }; | ||
function createNoExistsError(path) { | ||
var error = new Error('ENOENT, no such file or directory \'' + path + '\''); | ||
error.code = 'ENOENT'; | ||
error.errno = 34; | ||
error.path = path; | ||
error.syscall = 'open'; | ||
return error; | ||
} | ||
function md5(str, encoding){ | ||
return crypto | ||
function etag(buf){ | ||
var hash = crypto | ||
.createHash('md5') | ||
.update(str, 'utf8') | ||
.digest(encoding || 'hex'); | ||
.update(buf) | ||
.digest('base64'); | ||
return '"' + hash + '"'; | ||
} | ||
@@ -114,0 +104,0 @@ |
{ | ||
"name": "serve-favicon", | ||
"description": "favicon serving middleware with caching", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
@@ -11,9 +11,3 @@ "license": "MIT", | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/expressjs/serve-favicon.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/expressjs/serve-favicon/issues" | ||
}, | ||
"repository": "expressjs/serve-favicon", | ||
"dependencies": { | ||
@@ -23,6 +17,7 @@ "fresh": "0.2.2" | ||
"devDependencies": { | ||
"mocha": "~1.18.2", | ||
"proxyquire": "~0.6.0", | ||
"should": "~3.3.1", | ||
"supertest": "~0.12.0" | ||
"istanbul": "0.2.10", | ||
"mocha": "~1.20.1", | ||
"proxyquire": "~1.0.1", | ||
"should": "~4.0.1", | ||
"supertest": "~0.13.0" | ||
}, | ||
@@ -33,4 +28,6 @@ "engines": { | ||
"scripts": { | ||
"test": "mocha --reporter spec test/" | ||
"test": "mocha --reporter dot test/", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/", | ||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/" | ||
} | ||
} |
@@ -1,3 +0,7 @@ | ||
# serve-favicon [![Build Status](https://travis-ci.org/expressjs/serve-favicon.svg)](https://travis-ci.org/expressjs/serve-favicon) [![NPM version](https://badge.fury.io/js/serve-favicon.svg)](http://badge.fury.io/js/serve-favicon) | ||
# serve-favicon | ||
[![NPM version](https://badge.fury.io/js/serve-favicon.svg)](http://badge.fury.io/js/serve-favicon) | ||
[![Build Status](https://travis-ci.org/expressjs/serve-favicon.svg?branch=master)](https://travis-ci.org/expressjs/serve-favicon) | ||
[![Coverage Status](https://img.shields.io/coveralls/expressjs/serve-favicon.svg?branch=master)](https://coveralls.io/r/expressjs/serve-favicon) | ||
Node.js middleware for serving a favicon. | ||
@@ -4,0 +8,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7184
87
5
92
2
2