MCPcopy Index your code
hub / github.com/nodejs/node / createHandle

Function createHandle

lib/net.js:188–204  ·  view source on GitHub ↗
(fd, is_server)

Source from the content-addressed store, hash-verified

186}
187
188function createHandle(fd, is_server) {
189 validateInt32(fd, 'fd', 0);
190 const type = guessHandleType(fd);
191 if (type === 'PIPE') {
192 return new Pipe(
193 is_server ? PipeConstants.SERVER : PipeConstants.SOCKET,
194 );
195 }
196
197 if (type === 'TCP') {
198 return new TCP(
199 is_server ? TCPConstants.SERVER : TCPConstants.SOCKET,
200 );
201 }
202
203 throw new ERR_INVALID_FD_TYPE(type);
204}
205
206
207function getNewAsyncId(handle) {

Callers 2

SocketFunction · 0.70
createServerHandleFunction · 0.70

Calls 1

guessHandleTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…