diff options
Diffstat (limited to 'doc/api/dgram.md')
-rw-r--r-- | doc/api/dgram.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 1bb5155578..53eeb81898 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -233,7 +233,7 @@ Example of sending a UDP packet to a random port on `localhost`; ```js const dgram = require('dgram'); -const message = new Buffer('Some bytes'); +const message = Buffer.from('Some bytes'); const client = dgram.createSocket('udp4'); client.send(message, 41234, 'localhost', (err) => { client.close(); @@ -244,8 +244,8 @@ Example of sending a UDP packet composed of multiple buffers to a random port on ```js const dgram = require('dgram'); -const buf1 = new Buffer('Some '); -const buf2 = new Buffer('bytes'); +const buf1 = Buffer.from('Some '); +const buf2 = Buffer.from('bytes'); const client = dgram.createSocket('udp4'); client.send([buf1, buf2], 41234, 'localhost', (err) => { client.close(); |