2.0.2 • Published 12 months ago

parse-listen-string v2.0.2

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
12 months ago

parse-listen-string

npm.io npm.io

Node.js module to parse a listen string like 0.0.0.0:443.

Install

npm i parse-listen-string

Usage

import {parseListenString} from "parse-listen-string";

parseListenString("0.0.0.0:80")
//=> {host: "0.0.0.0", port: 80, proto: "http"}

parseListenString("https://[::1]:443")
//=> {host: "::1", port: 443, proto: "https"}

API

parseListenString(listenString)

  • listenString String or Number: A listen string to parse

Returns a object or null if string can not be parsed. Object properties:

  • proto String. Protocol, either http or https
  • host String: Listen host in form of an IP address
  • port Number: Listen port
  • path String: Unix socket path, this is mutual exclusive with host and port

© silverwind, distributed under BSD licence

2.0.2

12 months ago

2.0.1

12 months ago

1.1.1

2 years ago

1.1.0

2 years ago

2.0.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago