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

@playwright-labs/network-core

v1.0.0

Published

Network condition emulation over CDP — presets (2G/3G/4G/DSL/WiFi/offline), condition factory, NetworkAPI with async-dispose

Readme

@playwright-labs/network-core

Network condition emulation for Chromium over CDP — presets (GPRS → WiFi, offline), a validated condition factory, and a NetworkAPI handle with async-dispose cleanup.

Installation

pnpm add -D @playwright-labs/network-core

Quick start

import { test } from '@playwright/test';
import { NetworkAPI, createNetworkCondition, kbps } from '@playwright-labs/network-core';

test('page under slow 3G', async ({ page, context }) => {
  const session = await context.newCDPSession(page);
  await using network = new NetworkAPI(session);

  await network.start('Regular3G');          // preset by name
  await page.goto('/dashboard');
  // ...assertions under throttling...

  // scope exit (async dispose) restores normal networking
});

Presets

GPRS, Regular2G, Good2G, Regular3G, Good3G, Regular4G, DSL, WiFi, Offline, NoThrottling — exported as NETWORK_PRESETS, names typed as NetworkPreset.

| Preset | Download | Upload | Latency | |---|---|---|---| | GPRS | 50 Kbps | 20 Kbps | 500 ms | | Regular2G | 250 Kbps | 50 Kbps | 300 ms | | Good2G | 450 Kbps | 150 Kbps | 150 ms | | Regular3G | 750 Kbps | 250 Kbps | 100 ms | | Good3G | 1.5 Mbps | 750 Kbps | 40 ms | | Regular4G | 4 Mbps | 3 Mbps | 20 ms | | DSL | 2 Mbps | 1 Mbps | 5 ms | | WiFi | 30 Mbps | 15 Mbps | 2 ms |

Custom conditions

import { createNetworkCondition, kbps, mbps } from '@playwright-labs/network-core';

const flaky = createNetworkCondition({
  latency: 800,
  downloadThroughput: kbps(256),
  uploadThroughput: kbps(64),
});
await network.start(flaky);
  • omitted fields mean "no restriction" (-1 throughput, 0 latency, online)
  • validation: latency >= 0, throughput >= 0 or -1 (disable), finite numbers only — invalid input throws TypeError before any CDP call
  • results are frozen

NetworkAPI

| Member | Behaviour | |---|---| | start(preset \| condition) | applies and returns the resolved frozen NetworkCondition; enables the CDP Network domain on first call | | stop() | restores normal networking; idempotent | | condition | currently applied condition or null | | started | boolean | | await using / Symbol.asyncDispose | stop() on scope exit |

Limitations

  • Chromium only — CDP sessions are not available for Firefox/WebKit
  • throttling applies per CDP session (page), not per context

License

MIT