3rd-Eden / memcached

A fully featured Memcached client build on top of Node.js. Build with scaling in mind so it will support Memcached clusters and consistent hashing.
MIT License
1.31k stars 276 forks source link

[DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. #353

Open Spider84 opened 4 years ago

Spider84 commented 4 years ago
diff --git a/lib/memcached.js b/lib/memcached.js
index 9742a1d..2e1a94b 100644
--- a/lib/memcached.js
+++ b/lib/memcached.js
@@ -523,7 +523,7 @@ Client.config = {
           dataSet = +dataSet;
           break;
         case FLAG_BINARY:
-          tmp = new Buffer(dataSet.length);
+          tmp = Buffer.alloc(dataSet.length);
           tmp.write(dataSet, 0, 'binary');
           dataSet = tmp;
           break;
ankon commented 4 years ago

Related to #344?

Spider84 commented 4 years ago

Yes :)