sockaddr

Parse a string into a socket address (valid to pass to net.Socket)

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
sockaddr
1.0.14 years ago4 years agoMinified + gzip package size for sockaddr in KB

Readme

node-sockaddr
Build Status Coverage Status Greenkeeper badge
A simple library to convert a string into an object suitable to pass to net.Socket.connect and net.Server.listen. Useful for configuration files and setting hosts and ports in environment variables. Supports both Unix domain sockets and TCP sockets.

Usage

const sockaddr = require('sockaddr');

let socket = ...;
socket.connect(sockaddr('hostname:1234'));

See ./test.js for the full set of options supported.