New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

file-send

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-send - npm Package Compare versions

Comparing version 0.1.3 to 1.0.0

28

lib/send-stream.js

@@ -17,3 +17,3 @@ /**

var extname = path.extname;
var mime = require('mime'); // MIME
var mime = require('mime-types'); // MIME
var etag = require('etag'); // ETag

@@ -563,3 +563,3 @@ var fresh = require('fresh'); // Fresh

*/
SendStream.prototype.sendFile = function sendFile(path){
SendStream.prototype.sendFile = function (path){
var i = 0;

@@ -848,15 +848,19 @@ var pathStat;

// Get MIME
// Get type
type = mime.lookup(path);
charset = mime.charsets.lookup(type);
// Debug infomation
if (charset) {
debugResponse('Content-Type %s; charset=%s', type, charset);
} else {
debugResponse('Content-Type %s', type);
if (type) {
// Get charset
charset = mime.charset(type);
// Debug infomation
if (charset) {
debugResponse('Content-Type: %s; charset=%s', type, charset);
} else {
debugResponse('Content-Type: %s', type);
}
// Set Content-Type
response.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''));
}
// Set Content-Type
response.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''));
};

@@ -863,0 +867,0 @@

@@ -13,3 +13,2 @@ /**

var path = require('path');
var relative = path.relative;

@@ -43,3 +42,10 @@ // Variable declaration

util.isOutBound = function (path, base){
return /(?:^[\\\/]?)\.\.(?:[\\\/]|$)/.test(relative(base, path));
if (process.platform === 'win32') {
path = path.toLowerCase();
base = base.toLowerCase();
}
if (path.length < base.length) return true;
return path.indexOf(base) !== 0;
};

@@ -46,0 +52,0 @@

{
"name": "file-send",
"version": "0.1.3",
"version": "1.0.0",
"description": "A http file send",

@@ -39,3 +39,3 @@ "author": {

"fresh": "^0.3.0",
"mime": "^1.3.4",
"mime-types": "^2.1.10",
"destroy": "^1.0.4",

@@ -42,0 +42,0 @@ "colors": "^1.1.2",

@@ -34,3 +34,3 @@ file-send

http.createServer(function (request, response){
Send.use(request) // Create a new send stream
Send.parse(request) // Create a new send stream
.pipe(response); // Send stream to client

@@ -78,6 +78,6 @@ });

### Send.use(request)
### Send.parse(request)
```js
var stream = Send.use(request); // The Send.use return a new send stream
var stream = Send.parse(request); // The Send.parse return a new send stream
```

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

The `pipe` method is used to pipe the response into the Node.js HTTP response object, typically `Send.use(req).pipe(res)`.
The `pipe` method is used to pipe the response into the Node.js HTTP response object, typically `Send.parse(req).pipe(res)`.

@@ -160,3 +160,3 @@ ## Error-handling

// Transfer arbitrary files from within /www/example.com/public/*
Send.use(request)
Send.parse(request)
.on('error', error)

@@ -163,0 +163,0 @@ .on('directory', directory)

@@ -149,3 +149,3 @@ /**

*/
Send.prototype.use = function (requset){
Send.prototype.parse = function (requset){
return new SendStream(requset, this.options);

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