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/stream.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 stream module. Depends on the events module.
19
* @see http://nodejs.org/api/stream.html
20
* @see https://github.com/joyent/node/blob/master/lib/stream.js
21
* @externs
22
* @author Daniel Wirtz <[email protected]>
23
*/
24
25
/**
26
BEGIN_NODE_INCLUDE
27
var stream = require('stream');
28
END_NODE_INCLUDE
29
*/
30
31
var stream = {};
32
33
/**
34
* @constructor
35
* @param {Object=} options
36
* @extends events.EventEmitter
37
*/
38
stream.Stream = function(options) {};
39
40
/**
41
* @param {stream.Writable} dest
42
* @param {{end: boolean}=} pipeOpts
43
* @return {stream.Writable}
44
*/
45
stream.Stream.prototype.pipe = function(dest, pipeOpts) {};
46
47
/**
48
* @constructor
49
* @extends stream.Readable
50
*/
51
stream.ReadableStream = function() {};
52
53
/**
54
* @type {boolean}
55
*/
56
stream.ReadableStream.prototype.readable;
57
58
/**
59
* @param {string=} encoding
60
*/
61
stream.ReadableStream.prototype.setEncoding = function(encoding) {};
62
63
/**
64
*/
65
stream.ReadableStream.prototype.destroy = function() {};
66
67
/**
68
* @constructor
69
* @extends stream.Writable
70
*/
71
stream.WritableStream = function() {};
72
73
/**
74
*/
75
stream.WritableStream.prototype.drain = function() {};
76
77
/**
78
* @type {boolean}
79
*/
80
stream.WritableStream.prototype.writable;
81
82
/**
83
* @param {string|nodeBuffer.Buffer} buffer
84
* @param {string=} encoding
85
*/
86
stream.WritableStream.prototype.write = function(buffer, encoding) {};
87
88
/**
89
* @param {string|nodeBuffer.Buffer=} buffer
90
* @param {string=} encoding
91
* @param {function(*=)=} cb
92
*/
93
stream.WritableStream.prototype.end = function(buffer, encoding, cb) {};
94
95
/**
96
*/
97
stream.WritableStream.prototype.destroy = function() {};
98
99
/**
100
*/
101
stream.WritableStream.prototype.destroySoon = function() {};
102
103
// Undocumented
104
105
/**
106
* @constructor
107
* @param {Object=} options
108
* @extends stream.Stream
109
*/
110
stream.Readable = function(options) {};
111
112
/**
113
* @type {boolean}
114
* @deprecated
115
*/
116
stream.Readable.prototype.readable;
117
118
/**
119
* @protected
120
* @param {string|nodeBuffer.Buffer|null} chunk
121
* @return {boolean}
122
*/
123
stream.Readable.prototype.push = function(chunk) {};
124
125
/**
126
* @param {string|nodeBuffer.Buffer|null} chunk
127
* @return {boolean}
128
*/
129
stream.Readable.prototype.unshift = function(chunk) {};
130
131
/**
132
* @param {string} enc
133
*/
134
stream.Readable.prototype.setEncoding = function(enc) {};
135
136
/**
137
* @param {number=} n
138
* @return {nodeBuffer.Buffer|string|null}
139
*/
140
stream.Readable.prototype.read = function(n) {};
141
142
/**
143
* @protected
144
* @param {number} n
145
*/
146
stream.Readable.prototype._read = function(n) {};
147
148
/**
149
* @param {stream.Writable=} dest
150
* @return {stream.Readable}
151
*/
152
stream.Readable.prototype.unpipe = function(dest) {};
153
154
/**
155
*/
156
stream.Readable.prototype.resume = function() {};
157
158
/**
159
*/
160
stream.Readable.prototype.pause = function() {};
161
162
/**
163
* @param {stream.Stream} stream
164
* @return {stream.Readable}
165
*/
166
stream.Readable.prototype.wrap = function(stream) {};
167
168
/**
169
* @constructor
170
* @param {Object=} options
171
* @extends stream.Stream
172
*/
173
stream.Writable = function(options) {};
174
175
/**
176
* @deprecated
177
* @type {boolean}
178
*/
179
stream.Writable.prototype.writable;
180
181
/**
182
* @param {string|nodeBuffer.Buffer} chunk
183
* @param {string=} encoding
184
* @param {function(*=)=} cb
185
* @return {boolean}
186
*/
187
stream.Writable.prototype.write = function(chunk, encoding, cb) {};
188
189
/**
190
* @protected
191
* @param {string|nodeBuffer.Buffer} chunk
192
* @param {string} encoding
193
* @param {function(*=)} cb
194
*/
195
stream.Writable.prototype._write = function(chunk, encoding, cb) {};
196
197
/**
198
* @param {string|nodeBuffer.Buffer=} chunk
199
* @param {string=} encoding
200
* @param {function(*=)=} cb
201
*/
202
stream.Writable.prototype.end = function(chunk, encoding, cb) {};
203
204
/**
205
* @constructor
206
* @param {Object=} options
207
* @extends stream.Readable
208
* Xextends stream.Writable
209
*/
210
stream.Duplex = function(options) {};
211
212
/**
213
* @type {boolean}
214
*/
215
stream.Duplex.prototype.allowHalfOpen;
216
217
218
/**
219
* @param {Object=} options
220
* @constructor
221
* @extends stream.Duplex
222
*/
223
stream.Transform = function(options) {};
224
225
/**
226
* @protected
227
* @param {string|nodeBuffer.Buffer} chunk
228
* @param {string} encoding
229
* @param {function(*=)} cb
230
*/
231
stream.Transform._transform = function(chunk, encoding, cb) {};
232
233
/**
234
* @protected
235
* @param {function(*=)} cb
236
*/
237
stream.Transform._flush = function(cb) {};
238
239
/**
240
* @param {Object=} options
241
* @constructor
242
* @extends stream.Transform
243
*/
244
stream.PassThrough = function(options) {};
245
246