Skip to content

Commit 6144c56

Browse files
committed
fix: resolve warning for Buffer() in Node.js 10
1 parent a28983d commit 6144c56

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/redis.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ Redis.prototype.sendCommand = function (command, stream) {
597597

598598
if (!writable && command.name === 'quit' && this.offlineQueue.length === 0) {
599599
this.disconnect();
600-
command.resolve(new Buffer('OK'));
600+
command.resolve(Buffer.from('OK'));
601601
return command.promise;
602602
}
603603

lib/redis/parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ exports.returnError = function (err) {
7171

7272
var sharedBuffers = {};
7373
_.forEach(['message', 'pmessage', 'subscribe', 'psubscribe', 'unsubscribe', 'punsubscribe'], function (str) {
74-
sharedBuffers[str] = new Buffer(str);
74+
sharedBuffers[str] = Buffer.from(str);
7575
});
7676
exports.returnReply = function (reply) {
7777
if (this.status === 'monitoring') {

lib/utils/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports.bufferEqual = function (a, b) {
3535
* @return {*} The result
3636
* @example
3737
* ```js
38-
* var input = [new Buffer('foo'), [new Buffer('bar')]];
38+
* var input = [Buffer.from('foo'), [Buffer.from('bar')]];
3939
* var res = convertBufferToString(input, 'utf8');
4040
* expect(res).to.eql(['foo', ['bar']]);
4141
* ```

0 commit comments

Comments
 (0)