Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
consolr
Advanced tools
Readme
A utility to use with the input from terminal (process.stdin) while the application is running and emit events to handle internal server commands
I found it very useful while developing for example a chat application, using the event emitall and passing the message to all the connected sockets. In order to test, or in a production environment to make a global announcement.
0.9.0
With npm
$ npm install consolr
After you run your node application this leaves you with a prompt, just type what you need and press enter. Simple example, running this code will allow you to exit the application typing exit.
exit
var consolr = require('consolr');
consolr.on('command', function(command){
console.log("User have been input some command handle it as you need");
if(command == 'exit'){
console.log('Closing the app');
process.exit();
}
});
Custom events, to create custom events just type :yourcustomevent and then some text if you need it. eg.
:exit Closing the app
var consolr = require('consolr');
consolr.on('exit', function(command){
console.log(command);
process.exit();
});
The second example does the same as the first one
Now accepts JSON code, for example (It also works on the predefined event)
:someevent {message: 'Testing JSON', key:'value'}
var consolr = require('consolr');
consolr.on('someevent', function(data){
console.log(data.message);
});
That way it will only show the message because it will pass a JSON object instead of only string
Want to contribute? Great!
MIT
FAQs
A utility to use with the input from terminal (process.stdin) while the application is running and emit events to handle internal server commands
The npm package consolr receives a total of 8 weekly downloads. As such, consolr popularity was classified as not popular.
We found that consolr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.