# @ffflorian/mock-udp

> Mock dgram udp requests.

Latest version **1.15.14** (published 2026-10-29) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @ffflorian/mock-udp
pnpm add @ffflorian/mock-udp
yarn add @ffflorian/mock-udp
bun add @ffflorian/mock-udp
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.15.14 |
| Published | 2026-10-29 |
| First published | 2018-10-10 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Florian Imdahl |
| Maintainers | ffflorian |

## Links

- npm: https://www.npmjs.com/package/@ffflorian/mock-udp
- Repository: https://github.com/ffflorian/node-packages
- Homepage: https://github.com/ffflorian/node-packages#readme
- Issues: https://github.com/ffflorian/node-packages/issues
- npm.io page: https://npm.io/package/@ffflorian/mock-udp

## Recent versions

- 1.15.14 (latest) — 2026-10-29
- 1.15.13 — 2026-10-25
- 1.15.12 — 2026-10-22
- 1.15.11 — 2026-10-22
- 1.15.10 — 2026-10-16
- 1.15.9 — 2026-10-15
- 1.15.8 — 2026-10-08
- 1.15.7 — 2026-10-02
- 1.15.6 — 2026-09-25
- 1.15.5 — 2026-09-17
- 1.15.4 — 2026-09-10
- 1.15.3 — 2026-05-28
- 1.15.1 — 2026-03-28
- 1.15.0 — 2026-03-26
- 1.14.5 — 2026-03-26
- … 77 more at https://npm.io/package/@ffflorian/mock-udp/versions

## README

# mock-udp [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![npm version](https://img.shields.io/npm/v/@ffflorian/mock-udp.svg?style=flat)](https://www.npmjs.com/package/@ffflorian/mock-udp)

Mock dgram udp requests. Based on [node-mock-udp](https://github.com/mattrobenolt/node-mock-udp).

## Prerequisites

- [Node.js](https://nodejs.org)
- npm (preinstalled) or [yarn](https://yarnpkg.com)

## Installation

ℹ️ This is a pure [ESM](https://nodejs.org/api/esm.html#introduction) module.

Run `yarn add @ffflorian/mock-udp` or `npm i @ffflorian/mock-udp`.

## Usage

```ts
import dgram from 'node:dgram';
import mockudp from '@ffflorian/mock-udp';
// When imported, Socket gets patched immediately.

// Create scope to capture UDP requests
const scope = mockudp('localhost:1234');

const client = dgram.createSocket('udp4');
const message = Buffer.from('hello world');

client.send(message, 0, message.length, 1234, 'localhost', (err, bytes) => {
  scope.buffer; // the buffer which would have been sent
  scope.done(); // will return `true` if the scope was used, otherwise `false`.
});
```

---
_Source: https://npm.io/package/@ffflorian/mock-udp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
