npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

geberel

v4.0.0

Published

An IPC library using UNIX domains

Downloads

29

Readme

Geberel

An IPC library uses UNIX domains.

Server

const Geberel = require('geberel');
const options = { path: '/tmp/geberel.sock' };
const server = new Geberel.server(options);

server.on('error', function (error) {
	console.log(error);
});

server.on('connect', function (socket) {

	socket.on('error', function (error) {
		console.log(error);
	});

	socket.when('test', function (data) {
		console.log(data); // { hello: 'people' }
	});

	socket.respond('async', function (data, done) {
		setTimeout(function () {
			data.foo = 'bar';
			done(data);
		}, 1000);
	});

});

server.open();

Client

const Geberel = require('geberel');
const options = { path: '/tmp/geberel.sock' };
const client = new Geberel.client(options);

client.on('error', function (error) {
	console.log(error);
});

client.on('connect', function (socket) {

	client.on('error', function (error) {
		console.log(error);
	});

	socket.relay('test', { hello: 'people' }, function (error) {
		// triggers the test event
	});

	socket.request('async', { hello: 'world' }, function (error, data) {
		console.log(data); // { hello: 'world' , foo: bar }
	});

});

client.open();

API

Geberel.server(options, callback)

Extends the Events.EventEmitter class.

  • options: Object
    • path: String UNIX domain socket path. (Default: /tmp/geberel.sock)
    • allowHalfOpen: Boolean Indicates whether half-opened TCP connections are allowed. (Default: false)
    • pauseOnConnect: Boolean Indicates whether the socket should be paused on incoming connections. (Default: false)
    • socket: Object
      • autoClose: Boolean Defaults to true.
      • allowHalfOpen: Boolean Indicates whether half-opened TCP connections are allowed. (Default: false)
      • readable: Boolean Allow reads on the socket when an fd is passed, otherwise ignored. (Default: false)
      • writable: Boolean Allow writes on the socket when an fd is passed, otherwise ignored. (Default: false)
      • fd: Number If specified, wrap around an existing socket with the given file descriptor, otherwise a new socket will be created.
  • close: Function
  • open: Function
  • Events
    • error
    • open
    • close
    • connect

Geberel.client(options, callback)

Extends the Events.EventEmitter class.

  • options: Object
    • socket: Object
      • autoClose: Boolean Defaults to true.
    • path: String UNIX domain socket path. (Default: /tmp/geberel.sock)
    • fd: Number If specified, wrap around an existing socket with the given file descriptor, otherwise a new socket will be created.
    • allowHalfOpen: Boolean Indicates whether half-opened TCP connections are allowed. (Default: false)
    • readable: Boolean Allow reads on the socket when an fd is passed, otherwise ignored. (Default: false)
    • writable: Boolean Allow writes on the socket when an fd is passed, otherwise ignored. (Default: false)
    • fd: Number If specified, wrap around an existing socket with the given file descriptor, otherwise a new socket will be created.
  • close: Function
  • open: Function
  • Events
    • end
    • drain
    • error
    • open
    • close
    • connect
    • timeout

Geberel.socket([socket][, options])

Extends the Events.EventEmitter class.

  • socket: Net.Socket
  • options: Object
    • unref: Boolean Defaults to false.
    • encoding: String Defaults to utf8.
    • autoClose: Boolean Defaults to true.
  • when: Function
    • event: String
    • callback: Function
      • data: Object, Array Parsed using JSON.parse.
  • respond: Function
    • event: String
    • callback: Function
      • done: Function Accepts data to send back to Socket.request.
        • data: Object, Array Parsed using JSON.parse.
  • relay: Function
    • event: String
    • data: Object, Array Stringified using JSON.stringify.
    • callback: Function
  • request: Function
    • event: String
    • data: Object, Array Stringified using JSON.stringify.
    • callback: Function
  • Events
    • end
    • error
    • close

Authors

AlexanderElias

License

Why You Should Choose MPL-2.0 This project is licensed under the MPL-2.0 License