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

zeanium-node

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zeanium-node - npm Package Compare versions

Comparing version 0.7.1 to 0.8.0

8

package.json
{
"name": "zeanium-node",
"version": "0.7.1",
"version": "0.8.0",
"description": "Zeanium for Node.js, simple http server and custome your business.",

@@ -33,5 +33,5 @@ "main": "index.js",

"dependencies": {
"chokidar": "^1.7.0",
"formidable": "^1.1.1",
"mysql": "^2.13.0",
"chokidar": "^2.1.2",
"formidable": "^1.2.1",
"mysql": "^2.16.0",
"zeanium": "^1.1.29"

@@ -38,0 +38,0 @@ },

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

'./HttpServerContext',
'node:os',
'node:http',

@@ -14,2 +15,3 @@ 'node:https',

HttpServerContext,
node_os,
node_http,

@@ -35,3 +37,3 @@ node_https,

this.__initNodePaths(_config);
this.__createHttpServer(_config);
this.__initConfig(_config);
this.__createHttpServerContext(_config);

@@ -62,3 +64,40 @@ },

},
__createHttpServer: function (config){
__createClusterServer: function (config){
if(node_cluster.isMaster){
zn.info("主进程 "+ process.pid + " 正在运行中...");
var _cpus = node_os.cpus().length;
for(var i = 0; i < _cpus; i++){
node_cluster.fork();
}
node_cluster.on('exit', function (worker, code, signal){
zn.error("工作进程 "+worker.process.pid + " 已退出");
})
}else{
zn.info("服务启动...");
this.__createHttpServer2(config);
}
},
__initConfig: function (config){
var _port = config.port;
if(zn.is(_port, 'number')){
if(config.clusters){
var _min = _port,
_count = zn.is(config.clusters, 'number')?config.clusters:node_os.cpus().length,
_max = _min + _count;
_port = [_min];
while(_min<_max-1){
_min++;
_port.push(_min);
}
}else{
_port = [_port];
}
}
if(zn.is(_port, 'array')){
config.port = _port;
return _port.forEach((port)=>this.__createHttpServer(config, port));
}
},
__createHttpServer: function (config, port){
var _server = null;

@@ -73,3 +112,3 @@ if(config.https){

_server.addListener("close", this.__onClose.bind(this));
_server.listen(config.port, config.host);
_server.listen(port||config.port, config.host);
return _server;

@@ -76,0 +115,0 @@ },

@@ -0,1 +1,7 @@

/*Add current path to NODE_PATH*/
var path = require('path');
var _curr = process.cwd() + path.sep + 'node_modules';
var _parents = module.constructor._nodeModulePaths(_curr);
process.env.NODE_PATH = process.env.NODE_PATH + path.delimiter + _parents.join(path.delimiter);
module.constructor._initPaths();
module.exports = require('zeanium'), zn.ZN_PATH = __dirname;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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