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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@neomaventures/wait-for

v0.0.1

Published

Wait for a TCP port or HTTP endpoint to accept traffic. Host-side readiness polling for tests, with no agent inside the target.

Readme

@neomaventures/wait-for

Wait for a TCP port or HTTP endpoint to accept traffic. Host-side readiness polling for tests, with no agent inside the target.

npm version CI License: MIT

Installation

npm install --save-dev @neomaventures/wait-for

No dependencies, and no peer dependencies.

Why

docker compose up -d --wait blocks until every service is healthy, which is the right tool when your images declare a HEALTHCHECK. Two cases it does not cover:

  1. The image has no healthcheck. --wait then only waits for the container to be running, which is not the same as ready — the classic case being a database whose process has started but whose socket is not yet accepting.
  2. The image is too slim to probe itself. Compose healthchecks execute inside the container, so the image must carry curl, wget, nc or similar. Many slim and distroless images carry none, and adding one means maintaining a derived image purely to make it testable.

This runs on the host, so it needs nothing inside the target. Use the compose healthcheck where the image provides one, and this where it does not.

Usage

import { waitForHttp, waitForTcp } from "@neomaventures/wait-for"

// Block until a TCP port accepts a connection
await waitForTcp("localhost", 5432)

// Block until an endpoint answers 2xx
await waitForHttp("http://localhost:1080/mockserver/status", { method: "PUT" })

Typically in a Jest globalSetup, after your compose stack is up:

export default async function setup(): Promise<void> {
  await waitForTcp("localhost", 5432)
  await waitForHttp("http://localhost:1080/mockserver/status", {
    method: "PUT",
  })
}

Options

Both functions take the same options object.

| Option | Default | Meaning | | ------------ | ------- | --------------------------------------------- | | retries | 30 | Maximum attempts | | intervalMs | 1000 | Milliseconds between attempts | | timeoutMs | 30000 | Total time budget | | method | "GET" | HTTP method to probe with. waitForHttp only |

Polling stops at whichever limit is reached first — retries attempts or timeoutMs elapsed — and the returned promise rejects. A timeoutMs of 0 aborts before the first attempt.

waitForHttp treats any 2xx as ready and retries everything else, so a service answering 503 while it warms up is handled correctly.

API

waitForTcp(host, port, options?): Promise<void>

Resolves when a TCP connection succeeds. Rejects once the retry or timeout budget is exhausted.

waitForHttp(url, options?): Promise<void>

Resolves when the endpoint returns a 2xx status. Rejects once the retry or timeout budget is exhausted.

WaitOptions

The options interface shared by both.

License

MIT