summaryrefslogtreecommitdiff
path: root/lib/buffer.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/buffer.js')
-rw-r--r--lib/buffer.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/buffer.js b/lib/buffer.js
index 24a24f369b..ae4ef87072 100644
--- a/lib/buffer.js
+++ b/lib/buffer.js
@@ -654,9 +654,10 @@ Buffer.prototype.equals = function equals(otherBuffer) {
return _compare(this, otherBuffer) === 0;
};
+let INSPECT_MAX_BYTES = 50;
// Override how buffers are presented by util.inspect().
Buffer.prototype[customInspectSymbol] = function inspect(recurseTimes, ctx) {
- const max = exports.INSPECT_MAX_BYTES;
+ const max = INSPECT_MAX_BYTES;
const actualMax = Math.min(max, this.length);
const remaining = this.length - max;
let str = this.hexSlice(0, actualMax).replace(/(.{2})/g, '$1 ').trim();
@@ -1089,19 +1090,25 @@ if (internalBinding('config').hasIntl) {
};
}
-module.exports = exports = {
+module.exports = {
Buffer,
SlowBuffer,
transcode,
- INSPECT_MAX_BYTES: 50,
-
// Legacy
kMaxLength,
kStringMaxLength
};
-Object.defineProperty(exports, 'constants', {
- configurable: false,
- enumerable: true,
- value: constants
+Object.defineProperties(module.exports, {
+ constants: {
+ configurable: false,
+ enumerable: true,
+ value: constants
+ },
+ INSPECT_MAX_BYTES: {
+ configurable: true,
+ enumerable: true,
+ get() { return INSPECT_MAX_BYTES; },
+ set(val) { INSPECT_MAX_BYTES = val; }
+ }
});