Skip to content

Commit

Permalink
Use Buffer.byteLength not process._byteLength
Browse files Browse the repository at this point in the history
  • Loading branch information
fictorial committed Apr 21, 2010
1 parent aadd6e7 commit 06c4348
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/redis-client.js
Expand Up @@ -759,8 +759,8 @@ Client.prototype.sendCommand = function () {
offset += this.requestBuffer.asciiWrite(CRLF, offset);
} else if (arg.toString) {
var asString = arg.toString();
var serialized = '$' + process._byteLength(asString) + CRLF + asString + CRLF;
ensureSpaceFor(process._byteLength(serialized));
var serialized = '$' + Buffer.byteLength(asString) + CRLF + asString + CRLF;
ensureSpaceFor(Buffer.byteLength(serialized));
offset += this.requestBuffer.utf8Write(serialized, offset);
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Expand Up @@ -1692,7 +1692,7 @@ function testLargeGetSet() {

var fileContents = fs.readFileSync(__filename);

if (process._byteLength(fileContents) < client.requestBuffer.length)
if (Buffer.byteLength(fileContents) < client.requestBuffer.length)
assert.fail("the request buffer will not be forced to grow", "testGET (large; 0)");

client.set('largetestfile', fileContents, function (err, value) {
Expand Down Expand Up @@ -1731,7 +1731,7 @@ function testStoreAnImage(callback) {

// You can pass Buffer objects to the client's methods.

var imageBuffer = new Buffer(process._byteLength(fileContents));
var imageBuffer = new Buffer(Buffer.byteLength(fileContents));
imageBuffer.binaryWrite(fileContents, 0);

client.set('png_image', imageBuffer, function (err, value) {
Expand Down

0 comments on commit 06c4348

Please sign in to comment.