geoyws geoyws - 4 months ago 16
Node.js Question

The class net.Stream is not discussed in Node.js' documentation but is being used for node-postgres

https://github.com/brianc/node-postgres/blob/master/lib/connection.js

var net = require('net');
var Connection = function(config) {
...
config = config || {};
this.stream = config.stream || new net.Stream();
...
}


There is no mention at all of net.Stream in the documentation.
https://nodejs.org/api/net.html

Am I missing something?

Answer

Looks like it's just an alias to Socket.

exports.Stream = Socket; // Legacy naming.

Source: https://github.com/nodejs/node/blob/master/lib/net.js#L295