1.6.3 • Published 8 months ago

@ffflorian/mock-udp v1.6.3

Weekly downloads
9
License
GPL-3.0
Repository
-
Last release
8 months 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.6.3

8 months ago

1.5.5

11 months ago

1.5.4

1 year ago

1.6.2

10 months ago

1.6.1

10 months ago

1.6.0

11 months ago

1.5.3

1 year ago

1.5.2

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.9

1 year ago

1.4.10

1 year ago

1.4.8

1 year ago

1.4.7

1 year ago

1.4.6

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.3.1

2 years ago

1.0.4

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

7 years ago

0.0.2

7 years ago