Skip to content
This repository
Browse code

Expose read-only `UbjsonStream.sendBufferLength`

  • Loading branch information...
commit d1dffe3f14ca9c52b7d008b16ed33ae07ea3f6a3 1 parent ca284eb
Oleg Efimov authored

Showing 1 changed file with 11 additions and 1 deletion. Show diff stats Hide diff stats

  1. +11 1 lib/ubjson-stream.js
12 lib/ubjson-stream.js
@@ -14,6 +14,9 @@ var strtok = require('strtok');
14 14 var UbjsonParser = require("./ubjson-parser.js");
15 15 var ubjsonPack = require("./ubjson-pack.js");
16 16
  17 +// Send buffer length in bytes,
  18 +var sendBufferLength = 1024;
  19 +
17 20 /**
18 21 * class UbjsonStream < EventEmitter
19 22 *
@@ -47,7 +50,7 @@ function UbjsonStream(stream) {
47 50 self.send = function (value) {
48 51 // Check for send buffer
49 52 if (!(sendBuffer instanceof Buffer)) {
50   - sendBuffer = new Buffer(1024);
  53 + sendBuffer = new Buffer(sendBufferLength);
51 54 }
52 55
53 56 var flush = function(buffer, offset) {
@@ -117,5 +120,12 @@ function UbjsonStream(stream) {
117 120 // Inheritance
118 121 util.inherits(UbjsonStream, EventEmitter);
119 122
  123 +/** read-only
  124 + * UbjsonStream.sendBufferLength -> Integer
  125 + **/
  126 +UbjsonStream.__defineGetter__('sendBufferLength', function () {
  127 + return sendBufferLength;
  128 +});
  129 +
120 130 // Export
121 131 module.exports = UbjsonStream;

0 comments on commit d1dffe3

Please sign in to comment.
Something went wrong with that request. Please try again.