
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
conn-wrapper
Advanced tools
A simple wrapper for connections which only allows passing string.
There are a lots of times communication through connections and processes require dynamic Event Emitter rather than only listening on message
event. This module allows dev to create events dynamicly through those connections.
npm install --save conn-wrapper
const cp = require('child_process');
const child = cp.fork(path.join('./child.js'));
child.on('message', function(message) {
m = JSON.parse(message);
if (m.event === 'event1') {
// Do something
} else if (m.event === 'event2') {
// Do something
} else if (m.event === 'event2') {
...
}
...
})
const ConnWrapper = require('conn-wrapper');
const cp = require('child_process');
const child = cp.fork(path.join('./child.js'));
const wrapper = ConnWrapper(child);
// Send event
wrapper.send('event', payload)
// Listen for an event
wrapper.on('event1', function(payload) {
// Do something
});
To achieve this, the message
sent by conn.send()
must be a json or json format string. All other type will be ignored.
The message has 2 fields: event
(name of the event to be listened on) and body
(optinal, main content).
Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced. Feel free to learn more about him.
Yeoman and Generator-simple-package
MIT © nghiattran
FAQs
A wrapper for connections which only allows passing string.
The npm package conn-wrapper receives a total of 2 weekly downloads. As such, conn-wrapper popularity was classified as not popular.
We found that conn-wrapper 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.