Skip to content

A Node.js module for abstract Unix domain sockets on Linux and macOS.

License

Notifications You must be signed in to change notification settings

canvascat/abstract-socket

Repository files navigation

better-abstractsocket

English | 简体中文

better-abstractsocket is a Node.js module designed to create and manipulate abstract Unix domain sockets. It only supports Linux and macOS systems. This module encapsulates low - level socket operations, providing developers with a more convenient interface to create and manage abstract sockets.

Features

  • Platform Support: Only supports Linux and macOS systems.
  • Core Functions: Provides functions to create sockets (socket), bind addresses (bind), connect to sockets (connect), and close sockets (close).

Installation

pnpm install better-abstractsocket

Usage Examples

Create a Server

import AbstractSocket from 'better-abstractsocket';

const server = new AbstractSocket.Server();
server.listen('better-abstractsocket-example', () => {
    console.log('Server is listening on better-abstractsocket-example');
});

Create a Connection

import { createConnection } from 'better-abstractsocket';

const socket = createConnection('better-abstractsocket-example', () => {
    console.log('Connected to abstract socket');
});

API Documentation

AbstractSocket.Server

Inherits from net.Server and provides the listen method to listen on an abstract socket.

createConnection

Used to create a connection to a specified abstract socket.

supported

A boolean value indicating whether the current environment supports the better-abstractsocket module.

About

A Node.js module for abstract Unix domain sockets on Linux and macOS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published