npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-quic

v0.1.3

Published

A wrapper around fidm/quic, node-quic is a dead simple stream based QUIC server / client for use in node.js.

Readme

node-quic

A wrapper around fidm/quic, node-quic is a dead simple stream based QUIC server / client for use in node.js.

Travis Codecov npm

node-quic is a simple way to bring QUIC / UDP into your application.

Installation

npm install node-quic

Usage

import quic from 'node-quic'

const port    = 1234
const address = '127.0.0.1'     // default

quic.listen(port, address)
  .then(() => {})               // called once server starts listening

  .onError((error) => {})       // called if there's an error with the listening.
                                // There are three classes of error:
                                //    * 'server error'
                                //    * 'server session error'
                                //    * 'server stream error'
                                // An error will come out as an object with key
                                // `class` containing one of the above. More information
                                // will be in the error object.

  .onData(
    (data, stream, buffer) => {}
  )                             // data here will be a stringified version of
                                // whatever was sent using quic.send(), stream will have
                                // two function properties: `write` and `end.`
                                // Use stream.write(data) to return information to the
                                // original sender. Note: stream.write will automatically
                                // stringify any non-buffer data sent to it, but you will need
                                // to parse your own data on the way out of `.onData` for
                                // `quic.listen` and for `quic.send`.  Use `stream.end()`
                                // if you don't need to send anything back. If you are working
                                // with buffers directly and don't need anything stringified,
                                // you can use the buffer argument.

quic.send(port, address, data)  // Send data to a listening server. `data` is automatically
                                // stringified, but will need to be parsed manually on receive.

  .then(() => {})               // called after the stream is written

  .onError((error) => {})       // called on error. The error classes for `quic.send` are:
                                //   * 'client stream error'

  .onData((data, buffer) => {}) // `data` is populated by whatever the receiving server deems
                                // necessary to send back. `buffer` contains the unstringified
                                // version of the data.

There are also a few utility functions:

quic.stopListening()            // kill the server

quic.getServer()                // return low level server object. Note, a server will only be
                                // returned following a call to `.listen()` and preceding any
                                // calls to `.stopListening()`, a.k.a. when quic is listening.

quic.getAddress()               // returns an object {
                                //   port: <number>,
                                //   family: <string>, // like 'IPv4'
                                //   address: <string> // defaults to '127.0.0.1'
                                // }
                                // Note: these fields will be 0 or the empty string if quic
                                // is not listening.

For example:

const port    = 1234
const address = '127.0.0.1'

// First we listen.
quic.listen(port, address)
  .onData((data, stream, buffer) => {
    const parsedData = JSON.parse(data)

    console.log(parsedData) // { hello: 'world!' }

    // Once the data is received and logged, we'll send it right back
    stream.write(parsedData)
  })

// Now we send the data to the server.
quic.send(port, address, { hello: 'world!' })
  .onData(data => {

    // This is the data that was sent right back
    const parsedData = JSON.parse(data)
    console.log(parsedData) // { hello: 'world!' }

    // now we can stop the server from listening if we want this to be a one-off
    quic.stopListening()
  })

Easy Peasy. Enjoy!