Affected URL(s)
https://nodejs.org/api/net.html#new-netsocketoptions
Description of the problem
socket.connect() is described as accepting the following option:
onread {Object} If specified, incoming data is stored in a single buffer
and passed to the supplied callback when data arrives on the socket.
This will cause the streaming functionality to not provide any data.
The socket will emit events like 'error', 'end', and 'close'
as usual. Methods like pause() and resume() will also behave as
expected.
buffer {Buffer|Uint8Array|Function} Either a reusable chunk of memory to
use for storing incoming data or a function that returns such.
callback {Function} This function is called for every chunk of incoming
data. Two arguments are passed to it: the number of bytes written to
buffer and a reference to buffer. Return false from this function to
implicitly pause() the socket. This function will be executed in the
global context.
However, this is not correct, and is actually accepted only in the Socket() constructor:
|
if (onread !== null && typeof onread === 'object' && |
The example given using net.connect() is still correct because the options "Will be passed to both the new net.Socket([options]) call and the socket.connect(options[, connectListener]) method."
Affected URL(s)
https://nodejs.org/api/net.html#new-netsocketoptions
Description of the problem
socket.connect()is described as accepting the following option:However, this is not correct, and is actually accepted only in the
Socket()constructor:node/lib/net.js
Line 454 in b4e8f1b
The example given using
net.connect()is still correct because the options "Will be passed to both the newnet.Socket([options])call and thesocket.connect(options[, connectListener])method."