Socket
Socket
Sign inDemoInstall

send

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

send - npm Package Compare versions

Comparing version 0.13.1 to 0.13.2

5

HISTORY.md

@@ -0,1 +1,6 @@

0.13.2 / 2016-03-05
===================
* Fix invalid `Content-Type` header when `send.mime.default_type` unset
0.13.1 / 2016-01-16

@@ -2,0 +7,0 @@ ===================

11

index.js

@@ -729,7 +729,16 @@ /*!

SendStream.prototype.type = function(path){
SendStream.prototype.type = function type(path) {
var res = this.res;
if (res.getHeader('Content-Type')) return;
var type = mime.lookup(path);
if (!type) {
debug('no content-type');
return;
}
var charset = mime.charsets.lookup(type);
debug('content-type %s', type);

@@ -736,0 +745,0 @@ res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''));

4

package.json
{
"name": "send",
"description": "Better streaming static file server with Range and conditional-GET support",
"version": "0.13.1",
"version": "0.13.2",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -33,3 +33,3 @@ "contributors": [

"istanbul": "0.4.2",
"mocha": "2.3.4",
"mocha": "2.4.5",
"supertest": "1.1.0"

@@ -36,0 +36,0 @@ },

@@ -54,2 +54,8 @@ # send

##### end
Byte offset at which the stream ends, defaults to the length of the file
minus 1. The end is inclusive in the stream, meaning `end: 3` will include
the 4th byte in the stream.
##### etag

@@ -87,4 +93,9 @@

### Events
##### start
Byte offset at which the stream starts, defaults to 0. The start is inclusive,
meaning `start: 2` will include the 3rd byte in the stream.
#### Events
The `SendStream` is an event emitter and will emit the following events:

@@ -99,3 +110,3 @@

### .pipe
#### .pipe

@@ -105,2 +116,11 @@ The `pipe` method is used to pipe the response into the Node.js HTTP response

### .mime
The `mime` export is the global instance of of the
[`mime` npm module](https://www.npmjs.com/package/mime).
This is used to configure the MIME types that are associated with file extensions
as well as other options for how to resolve the MIME type of a file (like the
default type to use for an unknown file extension).
## Error-handling

@@ -147,3 +167,3 @@

Serving from a root directory with custom error-handling:
### Custom file types

@@ -153,2 +173,21 @@ ```js

var send = require('send');
// Default unknown types to text/plain
send.mime.default_type = 'text/plain';
// Add a custom type
send.mime.define({
'application/x-my-type': ['x-mt', 'x-mtt']
});
var app = http.createServer(function(req, res){
send(req, req.url).pipe(res);
}).listen(3000);
```
### Serving from a root directory with custom error-handling
```js
var http = require('http');
var send = require('send');
var url = require('url');

@@ -155,0 +194,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