FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Make buffer.INSPECT_MAX_BYTES public for mscdex · tmpvar/node@2689d26 · GitHub

Repository navigation

Commit 2689d26

Browse files
committed
Make buffer.INSPECT_MAX_BYTES public for mscdex
1 parent 7332c40 commit 2689d26

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎doc/api/buffers.markdown‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,3 +470,7 @@ given it will fill the entire buffer.
470470
var b = new Buffer(50);
471471
b.fill("h");
472472

473+
### INSPECT_MAX_BYTES
474+
475+
How many bytes will be returned when `b.inspect()` is called. This can
476+
be overriden by user modules.

‎lib/buffer.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
var SlowBuffer = process.binding('buffer').SlowBuffer;
2323
var assert = require('assert');
2424

25-
var INSPECT_MAX_BYTES = 50;
25+
exports.INSPECT_MAX_BYTES = 50;
2626

2727

2828
function toHex(n) {
@@ -36,7 +36,7 @@ SlowBuffer.prototype.inspect = function() {
3636
len = this.length;
3737
for (var i = 0; i < len; i++) {
3838
out[i] = toHex(this[i]);
39-
if (i == INSPECT_MAX_BYTES) {
39+
if (i == exports.INSPECT_MAX_BYTES) {
4040
out[i + 1] = '...';
4141
break;
4242
}
@@ -287,7 +287,7 @@ Buffer.prototype.inspect = function inspect() {
287287

288288
for (var i = 0; i < len; i++) {
289289
out[i] = toHex(this.parent[i + this.offset]);
290-
if (i == INSPECT_MAX_BYTES) {
290+
if (i == exports.INSPECT_MAX_BYTES) {
291291
out[i + 1] = '...';
292292
break;
293293
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL