Socket
Socket
Sign inDemoInstall

net-listen

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    net-listen

Listen helper for net module helping with socket listening


Version published
Weekly downloads
334
decreased by-35.52%
Maintainers
1
Install size
31.4 kB
Created
Weekly downloads
 

Readme

Source

net-listen

Node listen helper for net module helping with socket listening.

  • throw error when socket is used (server running)
  • when socket file is not used (server not running), is automatically removed and server started.
  • change socket mode to 0777 (chmod 0o777)

Installation

npm install net-listen --save
 
 

Usage

Getting started

var http = require('http');
var netListen = require('net-listen');

var server = http.createServer();
var path = 'path/to/socket.sock';

netListen.listen(server, path, function(err) {
	if (err) {
		console.error(err);
		process.exit();
	}
});

Alternative usage

netListen.listen(server, path, function(err) { ... });
netListen.listen(server, port, function(err) { ... });
netListen.listen(server, port, host, function(err) { ... });
netListen.listen(server, config, function(err) { ... });
  • path - String Unix socket file. Directory must be writable.
  • port - Number Listening TCP port
  • host - String Listening TCP host
  • config - Object Config is same as Net module listen options and can have some additional options:
    • pathMode - default 0o777

Keywords

FAQs

Last updated on 09 Feb 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc