Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

static-cling

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

static-cling - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

test/cli.js

12

lib/static.js

@@ -43,9 +43,13 @@ var path = require('path'),

var cling = function(options){
console.log('options', options);
var config = merge(defaults,options);
console.log('starting static server on port ' + config.port );
console.log('config', config);
http.createServer(function (req, res) {
var uri = url.parse(req.url).pathname;
var filename = path.join(config.root, uri);
console.log('please serve', filename);
console.log('serving from', config.root);
existsCheck(filename, function (exists) {
if (!exists) {
console.log('no exist', filename);
return sendFileNotFound(res);

@@ -55,3 +59,5 @@ }

if (fs.statSync(filename).isDirectory()) {
filename = path.resolve(config.root, path.join(filename, config.filename));
console.log('isDirectory');
filename = path.resolve(path.join(filename, config.filename));
console.log('filename', filename)
if(!existsCheck(filename)){

@@ -61,2 +67,3 @@ return sendFileNotFound(res);

}
fs.readFile(filename, 'binary', function (err, file) {

@@ -71,2 +78,3 @@ if (err) {

}
var type = mime.lookup(filename);

@@ -73,0 +81,0 @@ res.writeHead(200, {

2

package.json
{
"name": "static-cling",
"version": "1.0.0",
"version": "1.0.1",
"engines": [

@@ -5,0 +5,0 @@ "node >=4.2.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