Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/third_party/closure-compiler/node-externs/net.js
6174 views
1
/*
2
* Copyright 2012 The Closure Compiler Authors.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
/**
18
* @fileoverview Definitions for node's net module. Depends on the events and buffer modules.
19
* @see http://nodejs.org/api/net.html
20
* @see https://github.com/joyent/node/blob/master/lib/net.js
21
* @externs
22
* @author Daniel Wirtz <[email protected]>
23
*/
24
25
/**
26
BEGIN_NODE_INCLUDE
27
var net = require('net');
28
END_NODE_INCLUDE
29
*/
30
31
/**
32
* @type {Object.<string,*>}
33
*/
34
var net = {};
35
36
/**
37
* @typedef {{allowHalfOpen: ?boolean}}
38
*/
39
net.CreateOptions;
40
41
/**
42
* @param {(net.CreateOptions|function(...))=} options
43
* @param {function(...)=} connectionListener
44
* @return {net.Server}
45
*/
46
net.createServer = function(options, connectionListener) {};
47
48
/**
49
* @typedef {{port: ?number, host: ?string, localAddress: ?string, path: ?string, allowHalfOpen: ?boolean}}
50
*/
51
net.ConnectOptions;
52
53
/**
54
* @param {net.ConnectOptions|number|string} arg1
55
* @param {(function(...)|string)=} arg2
56
* @param {function(...)=} arg3
57
*/
58
net.connect = function(arg1, arg2, arg3) {};
59
60
/**
61
* @param {net.ConnectOptions|number|string} arg1
62
* @param {(function(...)|string)=} arg2
63
* @param {function(...)=} arg3
64
*/
65
net.createConnection = function(arg1, arg2, arg3) {};
66
67
/**
68
* @constructor
69
* @extends events.EventEmitter
70
*/
71
net.Server = function() {};
72
73
/**
74
*
75
* @param {number|*} port
76
* @param {(string|number|function(...))=} host
77
* @param {(number|function(...))=} backlog
78
* @param {function(...)=} callback
79
*/
80
net.Server.prototype.listen = function(port, host, backlog, callback) {};
81
82
/**
83
* @param {function(...)=} callback
84
*/
85
net.Server.prototype.close = function(callback) {};
86
87
/**
88
* @return {{port: number, family: string, address: string}}
89
*/
90
net.Server.prototype.address = function() {};
91
92
/**
93
* @type {number}
94
*/
95
net.Server.prototype.maxConnectinos;
96
97
/**
98
* @type {number}
99
*/
100
net.Server.prototype.connections;
101
102
/**
103
* @constructor
104
* @param {{fd: ?*, type: ?string, allowHalfOpen: ?boolean}=} options
105
* @extends events.EventEmitter
106
*/
107
net.Socket = function(options) {};
108
109
/**
110
* @param {number|string|function(...)} port
111
* @param {(string|function(...))=} host
112
* @param {function(...)=} connectListener
113
*/
114
net.Socket.prototype.connect = function(port, host, connectListener) {};
115
116
/**
117
* @type {number}
118
*/
119
net.Socket.prototype.bufferSize;
120
121
/**
122
* @param {?string=} encoding
123
*/
124
net.Socket.prototype.setEncoding = function(encoding) {};
125
126
/**
127
* @param {string|nodeBuffer.Buffer} data
128
* @param {(string|function(...))=}encoding
129
* @param {function(...)=} callback
130
*/
131
net.Socket.prototype.write = function(data, encoding, callback) {};
132
133
/**
134
* @param {(string|nodeBuffer.Buffer)=}data
135
* @param {string=} encoding
136
*/
137
net.Socket.prototype.end = function(data, encoding) {};
138
139
/**
140
*/
141
net.Socket.prototype.destroy = function() {};
142
143
/**
144
*/
145
net.Socket.prototype.pause = function() {};
146
147
/**
148
*/
149
net.Socket.prototype.resume = function() {};
150
151
/**
152
* @param {number} timeout
153
* @param {function(...)=} callback
154
*/
155
net.Socket.prototype.setTimeout = function(timeout, callback) {};
156
157
/**
158
* @param {boolean=} noDelay
159
*/
160
net.Socket.prototype.setNoDelay = function(noDelay) {};
161
162
/**
163
* @param {(boolean|number)=} enable
164
* @param {number=} initialDelay
165
*/
166
net.Socket.prototype.setKeepAlive = function(enable, initialDelay) {};
167
168
/**
169
* @return {string}
170
*/
171
net.Socket.prototype.address = function() {};
172
173
/**
174
* @type {?string}
175
*/
176
net.Socket.prototype.remoteAddress;
177
178
/**
179
* @type {?number}
180
*/
181
net.Socket.prototype.remotePort;
182
183
/**
184
* @type {number}
185
*/
186
net.Socket.prototype.bytesRead;
187
188
/**
189
* @type {number}
190
*/
191
net.Socket.prototype.bytesWritten;
192
193
/**
194
* @param {*} input
195
* @return {number}
196
*/
197
net.isIP = function(input) {};
198
199
/**
200
* @param {*} input
201
* @return {boolean}
202
*/
203
net.isIPv4 = function(input) {};
204
205
/**
206
* @param {*} input
207
* @return {boolean}
208
*/
209
net.isIPv6 = function(input) {};
210
211