New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cross-platform-sock

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-platform-sock

Create a unix sockets on both unix and windows

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
733
decreased by-39.62%
Maintainers
1
Weekly downloads
 
Created
Source

cross-platform-sock

Create unix sockets on both unix systems and windows

npm install cross-platform-sock

build status Build status

On unix it'll just use a unix socket and on windows it'll return a pipe name.

Usage

const xsock = require('cross-platform-sock')
const net = require('net')

const server = net.createServer(function (socket) {
  socket.end('hello unix socket')
})

const sock = xsock('./test.sock')

xsock.unlink(sock, function () {
  server.listen(sock, function () {
    const socket = net.connect(sock)

    socket.on('data', function (data) {
      console.log('data:', data)
    })
  })
})

Running the above should print

data: hello unix socket

On all systems.

API

sock = xsock(name)

Create a cross platform socket name.

xsock.unlink(sock, cb)

Unlink a previous socket. Only needed on unix systems. On windows this is just a noop.

License

MIT

FAQs

Package last updated on 06 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc