Socket
Socket
Sign inDemoInstall

ecstatic

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecstatic - npm Package Compare versions

Comparing version 0.6.1 to 0.7.0

4

ChangeLog.md

@@ -0,1 +1,5 @@

2015/03/18 Version 0.7.0
- Add support for specifying default content-type (as an alternative to application/octet-stream)
- Use url-join for autoIndex route, fixes windows problems
2015/03/01 Version 0.6.1

@@ -2,0 +6,0 @@ - Fix handleError fall-through with directory listings

13

lib/ecstatic.js

@@ -7,2 +7,3 @@ #! /usr/bin/env node

mime = require('mime'),
urlJoin = require('url-join'),
showDir = require('./ecstatic/showdir'),

@@ -121,3 +122,3 @@ version = JSON.parse(

return middleware({
url: path.join(encodeURIComponent(pathname), '/index.' + defaultExt)
url: urlJoin(encodeURIComponent(pathname), '/index.' + defaultExt)
}, res, function (err) {

@@ -165,3 +166,5 @@ if (err) {

// special case.
var contentType = mime.lookup(file), charSet;
var defaultType = opts.contentType || 'application/octet-stream',
contentType = mime.lookup(file, defaultType),
charSet;

@@ -179,3 +182,3 @@ if (contentType) {

// strip gz ending and lookup mime type
contentType = mime.lookup(path.basename(file, ".gz"));
contentType = mime.lookup(path.basename(file, ".gz"), defaultType);
}

@@ -203,3 +206,3 @@

'Content-Length': chunksize,
'Content-Type': contentType || 'application/octet-stream'
'Content-Type': contentType
});

@@ -226,3 +229,3 @@ fstream.pipe(res);

res.setHeader('content-length', stat.size);
res.setHeader('content-type', contentType || 'application/octet-stream');
res.setHeader('content-type', contentType);

@@ -229,0 +232,0 @@ if (req.method === "HEAD") {

@@ -14,2 +14,3 @@ // This is so you can have options aliasing and defaults in one place.

serverHeader = true;
contentType = 'application/octet-stream';

@@ -96,2 +97,13 @@ if (opts) {

[
'contentType',
'contenttype',
'content-type'
].some(function (k) {
if (typeof opts[k] !== 'undefined' && opts[k] !== null) {
contentType = opts[k];
return true;
}
});
}

@@ -109,4 +121,5 @@

handleError: handleError,
serverHeader: serverHeader
serverHeader: serverHeader,
contentType: contentType
};
};

@@ -5,3 +5,3 @@ {

"description": "A simple static file server middleware that works with both Express and Flatiron",
"version": "0.6.1",
"version": "0.7.0",
"homepage": "https://github.com/jfhbrook/node-ecstatic",

@@ -28,3 +28,4 @@ "repository": {

"mime": "^1.2.11",
"minimist": "^1.1.0"
"minimist": "^1.1.0",
"url-join": "0.0.1"
},

@@ -31,0 +32,0 @@ "devDependencies": {

@@ -137,2 +137,7 @@ # Ecstatic [![build status](https://secure.travis-ci.org/jfhbrook/node-ecstatic.png)](http://travis-ci.org/jfhbrook/node-ecstatic)

### `opts.contentType`
Set `opts.contentType` in order to change default Content-Type header value.
Defaults to **application/octet-stream**.
### `opts.handleError`

@@ -139,0 +144,0 @@

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