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.7.6 to 0.8.0

CHANGELOG.md

14

CONTRIBUTING.md

@@ -45,2 +45,16 @@ # Contributing Guidelines

## A Few Other Minor Guidelines
1. Keep your pull requests on-topic. A pull request purporting to tackle A
shouldn't also have commits changing B and C. Feel free to make separate pull
requests. For instance: A pull request should generally only update
dependencies when doing so is required to add the feature or fix the bug. This
feature can, of course, consist of updating dependencies.
2. I prefer maintaining the changelog and package.json version myself. This is
because I try to make a single commit for a tagged release contain all
changelog additions and the version bump, and this breaks down when there are
interstitial commits making updates to either.
3. In case you were wondering about dependencies, you may find this helpful:
[![dependencies status](https://david-dm.org/jfhbrook/node-ecstatic.svg)](https://david-dm.org/jfhbrook/node-ecstatic)
## Pull Request

@@ -47,0 +61,0 @@

13

lib/ecstatic.js

@@ -34,2 +34,13 @@ #! /usr/bin/env node

// Support hashes and .types files in mimeTypes @since 0.8
if (opts.mimeTypes) {
if (typeof opts.mimeTypes === 'string') {
mime.load(opts.mimeTypes);
}
else if (typeof opts.mimeTypes === 'object') {
mime.define(opts.mimeTypes);
}
}
return function middleware (req, res, next) {

@@ -192,3 +203,3 @@

res.on('close', function () {
fstream.destroy();
fstream.destroy();
});

@@ -195,0 +206,0 @@ res.writeHead(206, {

60

lib/ecstatic/opts.js

@@ -13,5 +13,10 @@ // This is so you can have options aliasing and defaults in one place.

handleError = true,
serverHeader = true;
contentType = 'application/octet-stream';
serverHeader = true,
contentType = 'application/octet-stream',
mimeTypes;
function isDeclared(k) {
return typeof opts[k] !== 'undefined' && opts[k] !== null;
}
if (opts) {

@@ -22,3 +27,3 @@ [

].some(function (k) {
if (typeof opts[k] !== 'undefined' && opts[k] !== null) {
if (isDeclared(k)) {
autoIndex = opts[k];

@@ -33,3 +38,3 @@ return true;

].some(function (k) {
if (typeof opts[k] !== 'undefined' && opts[k] !== null) {
if (isDeclared(k)) {
showDir = opts[k];

@@ -45,3 +50,3 @@ return true;

].some(function (k) {
if (typeof opts[k] !== 'undefined' && opts[k] !== null) {
if (isDeclared(k)) {
humanReadable = opts[k];

@@ -56,3 +61,3 @@ return true;

].some(function (k) {
if (typeof opts[k] !== 'undefined' && opts[k] !== null) {
if (isDeclared(k)) {
si = opts[k];

@@ -84,6 +89,6 @@ return true;

].some(function (k) {
if (typeof opts[k] !== 'undefined' && opts[k] !== null) {
handleError = opts[k];
return true;
}
if (isDeclared(k)) {
handleError = opts[k];
return true;
}
});

@@ -96,6 +101,6 @@

].some(function (k) {
if (typeof opts[k] !== 'undefined' && opts[k] !== null) {
serverHeader = opts[k];
return true;
}
if (isDeclared(k)) {
serverHeader = opts[k];
return true;
}
});

@@ -108,8 +113,24 @@

].some(function (k) {
if (typeof opts[k] !== 'undefined' && opts[k] !== null) {
contentType = opts[k];
return true;
}
if (isDeclared(k)) {
contentType = opts[k];
return true;
}
});
[
'mimetype',
'mimetypes',
'mimeType',
'mimeTypes',
'mime-type',
'mime-types',
'mime-Type',
'mime-Types'
].some(function (k) {
if (isDeclared(k)) {
mimeTypes = opts[k];
return true;
}
});
}

@@ -128,4 +149,5 @@

serverHeader: serverHeader,
contentType: contentType
contentType: contentType,
mimeTypes: mimeTypes
};
};

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

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

@@ -32,8 +32,10 @@ "repository": {

"devDependencies": {
"tap": "^0.4.13",
"eol": "^0.2.0",
"express": "^4.12.3",
"mkdirp": "^0.5.0",
"request": "^2.49.0",
"express": "^3.0.6",
"union": "^0.3.8",
"mkdirp": "^0.5.0"
}
"tap": "^1.0.3",
"union": "^0.4.4"
},
"license": "MIT"
}

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

gzip : false,
serverHeader : true
serverHeader : true,
contentType : 'application/octet-stream',
mimeTypes : undefined
}

@@ -143,2 +145,9 @@ ```

### `opts.mimeTypes`
Add new or override one or more mime-types. This affects the HTTP Content-Type header.
Can either be a path to a [`.types`](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) file or an object hash of type(s).
ecstatic({ mimeType: { 'mime-type': ['file_extension', 'file_extension'] } })
### `opts.handleError`

@@ -145,0 +154,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