Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

net-listen

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Issues
File Explorer

Advanced tools

net-listen

Listen helper for net module helping with socket listening

    0.1.1latest

Version published
Maintainers
1
Yearly downloads
93,007
increased by3633.72%

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

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc