Skip to content

Commit 666cf3f

Browse files
committed
Add duplex stream
1 parent 8f0b3b8 commit 666cf3f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/streams.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,29 @@ OutputStream.prototype._write = function (chunk, encoding, callback) {
110110
new this.type(chunks.shift()),
111111
callback.bind(this));
112112
};
113+
114+
/**
115+
* function IOStream([buffer])
116+
* Duplex stream interface for FastCGI input streams
117+
*/
118+
119+
function IOStream(conn, id, recordType) {
120+
stream.Duplex.call(this);
121+
122+
this.recordType = recordType || fcgi.records.StdOut;
123+
124+
this._buffer = [];
125+
this._canPush = true;
126+
127+
this._conn = conn;
128+
this._id = id;
129+
130+
this._open = true;
131+
}
132+
util.inherits(IOStream, stream.Duplex);
133+
134+
IOStream.prototype._data = InputStream.prototype._data;
135+
IOStream.prototype._read = InputStream.prototype._read;
136+
137+
IOStream.prototype.close = OutputStream.prototype.close;
138+
IOStream.prototype._write = OutputStream.prototype._write;

0 commit comments

Comments
 (0)