Skip to content

Commit e02a291

Browse files
committed
Pass excess params to send down to stream.write().
- This should allow this API to transparently accommodate a Stream implementation that can accept additional parameters (like file descriptors).
1 parent ba5d037 commit e02a291

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎lib/msgpack.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,17 @@ var Stream = function(s) {
2424
self.buf = null;
2525

2626
// Send a message down the stream
27+
//
28+
// Allows the caller to pass additional arguments, which are passed
29+
// faithfully down to the write() method of the underlying stream.
2730
self.send = function(m) {
28-
s.write(pack(m));
31+
// Sigh, no arguments.slice() method
32+
var args = [pack(m)];
33+
for (i = 1; i < arguments.length; i++) {
34+
args.push(arguments[i]);
35+
}
36+
37+
s.write.apply(s, args);
2938
};
3039

3140
// Listen for data from the underlying stream, consuming it and emitting

0 commit comments

Comments
 (0)