Socket
Socket
Sign inDemoInstall

ecstatic

Package Overview
Dependencies
Maintainers
1
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.5.6 to 0.5.7

test/range.js

15

lib/ecstatic.js

@@ -183,6 +183,17 @@ #! /usr/bin/env node

var start = parseInt(partialstart, 10);
var end = partialend ? parseInt(partialend, 10) : total-1;
var end = Math.min(total-1, partialend ? parseInt(partialend, 10) : total-1);
var chunksize = (end-start)+1;
if (start > end || isNaN(start) || isNaN(end)) {
return status['416'](res, next);
}
var fstream = fs.createReadStream(file, {start: start, end: end});
res.writeHead(206, { 'Content-Range': 'bytes ' + start + '-' + end + '/' + total, 'Accept-Ranges': 'bytes', 'Content-Length': chunksize, 'Content-Type': contentType || 'application/octet-stream' });
fstream.on('error', function (err) {
status['500'](res, next, { error: err });
});
res.writeHead(206, {
'Content-Range': 'bytes ' + start + '-' + end + '/' + total,
'Accept-Ranges': 'bytes',
'Content-Length': chunksize,
'Content-Type': contentType || 'application/octet-stream'
});
fstream.pipe(res);

@@ -189,0 +200,0 @@ return;

@@ -47,2 +47,15 @@ // not modified

exports['416'] = function (res, next) {
res.statusCode = 416;
if (typeof next === "function") {
next();
}
else {
if (res.writable) {
res.setHeader('content-type', 'text/plain');
res.end('Requested range not satisfiable');
}
}
};
// flagrant error

@@ -49,0 +62,0 @@ exports['500'] = function (res, next, opts) {

2

package.json

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

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

@@ -8,0 +8,0 @@ "repository": {

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