Browse Source

Make buffer.INSPECT_MAX_BYTES public for mscdex

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
2689d262ec
  1. 4
      doc/api/buffers.markdown
  2. 6
      lib/buffer.js

4
doc/api/buffers.markdown

@ -470,3 +470,7 @@ given it will fill the entire buffer.
var b = new Buffer(50);
b.fill("h");
### INSPECT_MAX_BYTES
How many bytes will be returned when `b.inspect()` is called. This can
be overriden by user modules.

6
lib/buffer.js

@ -22,7 +22,7 @@
var SlowBuffer = process.binding('buffer').SlowBuffer;
var assert = require('assert');
var INSPECT_MAX_BYTES = 50;
exports.INSPECT_MAX_BYTES = 50;
function toHex(n) {
@ -36,7 +36,7 @@ SlowBuffer.prototype.inspect = function() {
len = this.length;
for (var i = 0; i < len; i++) {
out[i] = toHex(this[i]);
if (i == INSPECT_MAX_BYTES) {
if (i == exports.INSPECT_MAX_BYTES) {
out[i + 1] = '...';
break;
}
@ -287,7 +287,7 @@ Buffer.prototype.inspect = function inspect() {
for (var i = 0; i < len; i++) {
out[i] = toHex(this.parent[i + this.offset]);
if (i == INSPECT_MAX_BYTES) {
if (i == exports.INSPECT_MAX_BYTES) {
out[i + 1] = '...';
break;
}

Loading…
Cancel
Save