Permalink
Browse files

Expose read-only `UbjsonStream.sendBufferLength`

  • Loading branch information...
Sannis committed Jul 7, 2012
1 parent ca284eb commit d1dffe3f14ca9c52b7d008b16ed33ae07ea3f6a3
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/ubjson-stream.js
View
@@ -14,6 +14,9 @@ var strtok = require('strtok');
var UbjsonParser = require("./ubjson-parser.js");
var ubjsonPack = require("./ubjson-pack.js");
+// Send buffer length in bytes,
+var sendBufferLength = 1024;
+
/**
* class UbjsonStream < EventEmitter
*
@@ -47,7 +50,7 @@ function UbjsonStream(stream) {
self.send = function (value) {
// Check for send buffer
if (!(sendBuffer instanceof Buffer)) {
- sendBuffer = new Buffer(1024);
+ sendBuffer = new Buffer(sendBufferLength);
}
var flush = function(buffer, offset) {
@@ -117,5 +120,12 @@ function UbjsonStream(stream) {
// Inheritance
util.inherits(UbjsonStream, EventEmitter);
+/** read-only
+ * UbjsonStream.sendBufferLength -> Integer
+ **/
+UbjsonStream.__defineGetter__('sendBufferLength', function () {
+ return sendBufferLength;
+});
+
// Export
module.exports = UbjsonStream;

0 comments on commit d1dffe3

Please sign in to comment.