1.5.3 • Published 6 days ago

@ffflorian/mock-udp v1.5.3

Weekly downloads
9
License
GPL-3.0
Repository
github
Last release
6 days ago

mock-udp License: GPL v3 npm version

Mock dgram udp requests. Based on node-mock-udp.

Prerequisites

Installation

ℹ️ This is a hybrid CommonJS / ESM module.

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

Usage

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`.
});
1.5.3

6 days ago

1.5.2

4 months ago

1.5.1

4 months ago

1.5.0

4 months ago

1.4.9

4 months ago

1.4.10

4 months ago

1.4.8

4 months ago

1.4.7

4 months ago

1.4.6

5 months ago

1.4.5

5 months ago

1.4.4

5 months ago

1.4.3

5 months ago

1.4.2

6 months ago

1.4.1

6 months ago

1.4.0

6 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.3.1

1 year ago

1.0.4

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

4 years ago

0.2.0

4 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

6 years ago