Sha256: cdbed99634b523be655225df1547cd00295e3041cb02848c652ddad5e6787e49

Contents?: true

Size: 749 Bytes

Versions: 76

Compression:

Stored size: 749 Bytes

Contents

'use strict';

var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;

function highWaterMarkFrom(options, isDuplex, duplexKey) {
  return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
}

function getHighWaterMark(state, options, duplexKey, isDuplex) {
  var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);

  if (hwm != null) {
    if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
      var name = isDuplex ? duplexKey : 'highWaterMark';
      throw new ERR_INVALID_OPT_VALUE(name, hwm);
    }

    return Math.floor(hwm);
  } // Default value


  return state.objectMode ? 16 : 16 * 1024;
}

module.exports = {
  getHighWaterMark: getHighWaterMark
};

Version data entries

76 entries across 57 versions & 11 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/spdy-transport/node_modules/readable-stream/lib/internal/streams/state.js
optimacms-0.1.61 spec/dummy/node_modules/hash-base/node_modules/readable-stream/lib/internal/streams/state.js
optimacms-0.1.61 spec/dummy/node_modules/browserify-sign/node_modules/readable-stream/lib/internal/streams/state.js
disco_app-0.18.0 test/dummy/node_modules/spdy-transport/node_modules/readable-stream/lib/internal/streams/state.js
disco_app-0.18.2 test/dummy/node_modules/spdy-transport/node_modules/readable-stream/lib/internal/streams/state.js
trusty-cms-5.0.7 node_modules/readable-stream/lib/internal/streams/state.js
trusty-cms-5.0.6 node_modules/readable-stream/lib/internal/streams/state.js
trusty-cms-5.0.5 node_modules/readable-stream/lib/internal/streams/state.js
trusty-cms-5.0.4 node_modules/readable-stream/lib/internal/streams/state.js
disco_app-0.16.1 test/dummy/node_modules/spdy-transport/node_modules/readable-stream/lib/internal/streams/state.js
isomorfeus-puppetmaster-0.5.5 node_modules/readable-stream/lib/internal/streams/state.js
isomorfeus-puppetmaster-0.5.4 node_modules/readable-stream/lib/internal/streams/state.js
disco_app-0.15.2 test/dummy/node_modules/spdy-transport/node_modules/readable-stream/lib/internal/streams/state.js
isomorfeus-puppetmaster-0.5.3 node_modules/readable-stream/lib/internal/streams/state.js
trusty-cms-5.0.3 node_modules/readable-stream/lib/internal/streams/state.js
trusty-cms-5.0.2 node_modules/readable-stream/lib/internal/streams/state.js
disco_app-0.18.4 test/dummy/node_modules/spdy-transport/node_modules/readable-stream/lib/internal/streams/state.js
disco_app-0.18.1 test/dummy/node_modules/spdy-transport/node_modules/readable-stream/lib/internal/streams/state.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/spdy-transport/node_modules/readable-stream/lib/internal/streams/state.js
disco_app-0.14.0 test/dummy/node_modules/spdy-transport/node_modules/readable-stream/lib/internal/streams/state.js