@@ -245,20 +245,23 @@ chained.
245
245
<!-- YAML
246
246
added: v0.1.99
247
247
changes:
248
+ - version: REPLACEME
249
+ pr-url: https://github.com/nodejs/node/pull/11985
250
+ description: The `msg` parameter can be an Uint8Array now.
251
+ - version: REPLACEME
252
+ pr-url: https://github.com/nodejs/node/pull/10473
253
+ description: The `address` parameter is always optional now.
248
254
- version: v6.0.0
249
255
pr-url: https://github.com/nodejs/node/pull/5929
250
256
description: On success, `callback` will now be called with an `error`
251
257
argument of `null` rather than `0`.
252
- - version: REPLACEME
253
- pr-url: https://github.com/nodejs/node/pull/10473
254
- description: The `address` parameter is always optional now.
255
258
- version: v5.7.0
256
259
pr-url: https://github.com/nodejs/node/pull/4374
257
260
description: The `msg` parameter can be an array now. Also, the `offset`
258
261
and `length` parameters are optional now.
259
262
-->
260
263
261
- * ` msg ` {Buffer|string|array} Message to be sent
264
+ * ` msg ` {Buffer|Uint8Array| string|array} Message to be sent
262
265
* ` offset ` {number} Integer. Optional. Offset in the buffer where the message starts.
263
266
* ` length ` {number} Integer. Optional. Number of bytes in the message.
264
267
* ` port ` {number} Integer. Destination port.
@@ -269,7 +272,8 @@ Broadcasts a datagram on the socket. The destination `port` and `address` must
269
272
be specified.
270
273
271
274
The ` msg ` argument contains the message to be sent.
272
- Depending on its type, different behavior can apply. If ` msg ` is a ` Buffer ` ,
275
+ Depending on its type, different behavior can apply. If ` msg ` is a ` Buffer `
276
+ or ` Uint8Array ` ,
273
277
the ` offset ` and ` length ` specify the offset within the ` Buffer ` where the
274
278
message begins and the number of bytes in the message, respectively.
275
279
If ` msg ` is a ` String ` , then it is automatically converted to a ` Buffer `
@@ -299,7 +303,7 @@ the error is emitted as an `'error'` event on the `socket` object.
299
303
300
304
Offset and length are optional, but if you specify one you would need to
301
305
specify the other. Also, they are supported only when the first
302
- argument is a ` Buffer ` .
306
+ argument is a ` Buffer ` or ` Uint8Array ` .
303
307
304
308
Example of sending a UDP packet to a random port on ` localhost ` ;
305
309
0 commit comments