forked from sitegui/nodejs-websocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InStream.js
44 lines (37 loc) · 796 Bytes
/
InStream.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* @file Simple wrapper for stream.Readable, used for receiving binary data
*/
'use strict'
var util = require('util'),
stream = require('stream')
/**
* Represents the readable stream for binary frames
* @class
* @event readable
* @event end
*/
function InStream() {
stream.Readable.call(this)
}
module.exports = InStream
util.inherits(InStream, stream.Readable)
/**
* No logic here, the pushs are made outside _read
* @private
*/
InStream.prototype._read = function () {}
/**
* Add more data to the stream and fires "readable" event
* @param {Buffer} data
* @private
*/
InStream.prototype.addData = function (data) {
this.push(data)
}
/**
* Indicates there is no more data to add to the stream
* @private
*/
InStream.prototype.end = function () {
this.push(null)
}