node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey »


Build Status


At the moment, node does not support unix stream connections from a socket bound to a local path. As stated in, it likely won't be supported as Windows doesn't have this feature.

This module adds this functionality and expands net.Socket to add localPath and remotePath getters and a path() functions that implement a similar functionality to localAddress and remoteAddress and address() for unix stream sockets.


npm install unix-stream


var net = require('net');
var fs = require('fs');
var unix = require('unix-stream');
// Create Unix socket Server bound to /tmp/remote_path
if (fs.existsSync('/tmp/remote_path')) {
var server = net.createServer(function(con) {
    console.log("[Server] Client connected from: " + con.remotePath);
    con.on('data', function(data) {
        console.log('Data received by server: ' + data);
    con.on('end', function() {
server.listen('/tmp/remote_path', function() {
    // Create Unix socket bound to /tmp/local_path
    if (fs.existsSync('/tmp/local_path')) {
    var socket = unix.createSocket('/tmp/local_path');
    socket.on('error', function(err) {
    // Connect to /tmp/remote_path
    socket.connect({ path : '/tmp/remote_path' }, function() {
        console.log("[Client] Client bound to: " + this.localPath + 
                    " connected to: " + this.remotePath);
    socket.on('data', function(data) {
        console.log('Data received by client: ' + data);

Bitdeli Badge