Browse Source

home-path and byte-size

master
Lloyd Brookes 11 years ago
parent
commit
51a998204a
  1. 8
      bin/ws.js
  2. 2
      package.json

8
bin/ws.js

@ -10,7 +10,9 @@ var dope = require("console-dope"),
morgan = require("morgan"), morgan = require("morgan"),
serveStatic = require("serve-static"), serveStatic = require("serve-static"),
directory = require("serve-index"), directory = require("serve-index"),
compress = require("compression");
compress = require("compression"),
homePath = require("home-path"),
byteSize = require("byte-size");
var usage = var usage =
"usage: \n\ "usage: \n\
@ -30,7 +32,7 @@ function halt(message){
- {cwd}/package.json - {cwd}/package.json
*/ */
var storedConfig = loadConfig( var storedConfig = loadConfig(
path.join(w.getHomeDir(), ".local-web-server.json"),
path.join(homePath(), ".local-web-server.json"),
path.join(process.cwd(), ".local-web-server.json"), path.join(process.cwd(), ".local-web-server.json"),
path.join(process.cwd(), "package.json:local-web-server") path.join(process.cwd(), "package.json:local-web-server")
); );
@ -127,7 +129,7 @@ if (argv.config){
} }
oldWrite.call(this, data); oldWrite.call(this, data);
total.bytes += data.length; total.bytes += data.length;
dope.column(12).write(w.padRight(w.bytesToSize(total.bytes, 2), 12));
dope.column(12).write(w.padRight(byteSize(total.bytes, 2), 12));
}; };
dope.column(24).write(++total.connections); dope.column(24).write(++total.connections);
socket.on("close", function(){ socket.on("close", function(){

2
package.json

@ -14,11 +14,13 @@
"repository": "https://github.com/75lb/local-web-server", "repository": "https://github.com/75lb/local-web-server",
"author": "Lloyd Brookes", "author": "Lloyd Brookes",
"dependencies": { "dependencies": {
"byte-size": "^0.1.0",
"command-line-args": "^0.2.0", "command-line-args": "^0.2.0",
"compression": "^1.0.2", "compression": "^1.0.2",
"config-master": "~0.1.0", "config-master": "~0.1.0",
"connect": "^3.0.0", "connect": "^3.0.0",
"console-dope": "^0.3.0", "console-dope": "^0.3.0",
"home-path": "^0.1.1",
"morgan": "^1.0.0", "morgan": "^1.0.0",
"serve-index": "^1.0.2", "serve-index": "^1.0.2",
"serve-static": "^1.1.0", "serve-static": "^1.1.0",

Loading…
Cancel
Save