1 | var inherits = require('util').inherits;
|
2 | var Readable = require('stream').Readable;
|
3 | var util = require('./util');
|
4 |
|
5 |
|
6 | function OpStream() {
|
7 | Readable.call(this, {objectMode: true});
|
8 | this.id = null;
|
9 | this.open = true;
|
10 | }
|
11 | module.exports = OpStream;
|
12 |
|
13 | inherits(OpStream, Readable);
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | OpStream.prototype._read = util.doNothing;
|
21 |
|
22 | OpStream.prototype.pushData = function(data) {
|
23 |
|
24 | if (!this.open) return;
|
25 |
|
26 | this.push(data);
|
27 | };
|
28 |
|
29 | OpStream.prototype.destroy = function() {
|
30 |
|
31 | if (!this.open) return;
|
32 | this.open = false;
|
33 |
|
34 | this.push(null);
|
35 | this.emit('close');
|
36 | };
|