Gathering detailed insights and metrics for bonjour-service
Gathering detailed insights and metrics for bonjour-service
Gathering detailed insights and metrics for bonjour-service
Gathering detailed insights and metrics for bonjour-service
A Bonjour/Zeroconf protocol implementation in TypeScript
npm install bonjour-service
Typescript
Module System
Node Version
NPM Version
99.2
Supply Chain
100
Quality
76.6
Maintenance
100
Vulnerability
100
License
TypeScript (77.78%)
JavaScript (22.22%)
Total Downloads
1,120,776,266
Last Day
435,699
Last Week
9,864,489
Last Month
43,082,126
Last Year
469,817,032
MIT License
93 Stars
247 Commits
27 Forks
2 Watchers
3 Branches
1 Contributors
Updated on Jun 29, 2025
Minified
Minified + Gzipped
Latest Version
1.3.0
Package Id
bonjour-service@1.3.0
Unpacked Size
65.01 kB
Size
16.82 kB
File Count
40
NPM Version
10.9.0
Node Version
22.11.0
Published on
Nov 18, 2024
Cumulative downloads
Total Downloads
Last Day
-6.6%
435,699
Compared to previous day
Last Week
-10%
9,864,489
Compared to previous week
Last Month
0.4%
43,082,126
Compared to previous month
Last Year
21.4%
469,817,032
Compared to previous year
A Bonjour/Zeroconf protocol implementation in TypeScript. Publish services on the local network or discover existing services using multicast DNS.
This is a rewrite of the project Bonjour (https://github.com/watson/bonjour) into modern TypeScript.
bonjour-service is supported by ON LX Limited. Check out our projects such as Ctrl Suite and Ctrl for iPad.
Add to your project dependencies using Yarn or NPM.
yarn add bonjour-service
npm install bonjour-service
1import { Bonjour } from 'bonjour-service' 2 3const instance = new Bonjour() 4 5// advertise an HTTP server on port 3000 6instance.publish({ name: 'My Web Server', type: 'http', port: 3000 }) 7 8// browse for all http services 9instance.find({ type: 'http' }, function (service) { 10 console.log('Found an HTTP server:', service) 11})
1var instance = new Bonjour({ options }, errorCallback)
The options
are optional and will be used when initializing the
underlying multicast-dns server. For details see the multicast-dns
documentation.
errorCallback
is an optional callback used to gracefully handle errors that would otherwise
crash the process. While not being strictly required, providing this is highly recommended
var service = bonjour.publish(options)
Publishes a new service.
Options are:
name
(string)host
(string, optional) - defaults to local hostnameport
(number)type
(string)subtypes
(array of strings, optional)protocol
(string, optional) - udp
or tcp
(default)txt
(object, optional) - a key/value object to broadcast as the TXT
recorddisableIPv6
(boolean, optional) disble IPv6 addressesIANA maintains a list of official service types and port numbers.
bonjour.unpublishAll([callback])
Unpublish all services. The optional callback
will be called when the
services have been unpublished.
bonjour.destroy()
Destroy the mdns instance. Closes the udp socket.
var browser = bonjour.find(options[, onup])
Listen for services advertised on the network. An optional callback can
be provided as the 2nd argument and will be added as an event listener
for the up
event.
Options (all optional):
type
(string)subtypes
(array of strings)protocol
(string) - defaults to tcp
txt
(object) - passed into dns-txt
module contructor. Set to { binary: true }
if you want to keep the TXT records in binaryvar browser = bonjour.findOne(options[, callback])
Listen for and call the callback
with the first instance of a service
matching the options
. If no callback
is given, it's expected that
you listen for the up
event. The returned browser
will automatically
stop it self after the first matching service.
Options are the same as given in the browser.find
function.
Event: up
Emitted every time a new service is found that matches the browser.
Event: down
Emitted every time an existing service emmits a goodbye message.
Event: txt-update
Emitted every time an existing service does a new announcement with an updated TXT record.
browser.services()
An array of services known by the browser to be online.
browser.start()
Start looking for matching services.
browser.stop()
Stop looking for matching services.
browser.update()
Broadcast the query again.
Event: up
Emitted when the service is up.
Event: error
Emitted if an error occurrs while publishing the service.
service.stop([callback])
Unpublish the service. The optional callback
will be called when the
service have been unpublished.
service.start()
Publish the service.
service.name
The name of the service, e.g. Apple TV
.
service.type
The type of the service, e.g. http
.
service.subtypes
An array of subtypes. Note that this property might be null
.
service.protocol
The protocol used by the service, e.g. tcp
.
service.host
The hostname or ip address where the service resides.
service.port
The port on which the service listens, e.g. 5000
.
service.fqdn
The fully qualified domain name of the service. E.g. if given the name
Foo Bar
, the type http
and the protocol tcp
, the service.fqdn
property will be Foo Bar._http._tcp.local
.
service.txt
The TXT record advertised by the service (a key/value object). Note that
this property might be null
.
service.published
A boolean indicating if the service is currently published.
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 3
Details
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More