1.2.0 • Published 6 years ago

unix-socket-streams2 v1.2.0

Weekly downloads
159
License
ISC
Repository
github
Last release
6 years ago

Unix-Socket-Streams2

This is a small helper library that accomplishes a few purposes for more easily dealing with unix domain sockets.

  • It supports both tcp (streaming) and udp (datagram) modes, and will attempt to switch to the appropriate mode if you open the socket in the wrong mode and/or simply don't know
  • It wraps the library node-unix-datagram in a "proper" Node streams2 stream, including incorporating that module's congestion control mechanism

That's really all there is to it.

Install

npm install unix-socket-streams2

Use

var UnixStream = require('unix-socket-streams2');
var socket = new UnixStream();
socket.connect('/path/to/socket', function (err, stream) { });

Api

UnixStream#connect

socket.connect(path, opts callback);

You may specify the type of socket to initially attempt to connect as like so:

var socket = new UnixStream('/path/to/socket', { type: 'tcp' });

Valid options are 'tcp' and 'dgram'

UnixStream#end

socket.end(callback);

UnixStream#write

socket.write(callback);

Test

git clone https://github.com/myndzi/unix-socket-streams2
cd unix-socket-streams2
npm test
1.2.0

6 years ago

1.1.0

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

11 years ago

1.0.3

11 years ago

1.0.2

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago