From 1937d2d3225a7dd5b00fcf3fb65f0ab8d1240715 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Wed, 24 Mar 2021 23:39:05 +0100 Subject: [PATCH] buid: use Buffer.from instead of Buffer constructor > DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. --- lib/urlsafe-base64.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/urlsafe-base64.js b/lib/urlsafe-base64.js index 7f26afa..068a4e2 100644 --- a/lib/urlsafe-base64.js +++ b/lib/urlsafe-base64.js @@ -56,7 +56,7 @@ exports.decode = function decode(base64) { .replace(/\-/g, '+') // Convert '-' to '+' .replace(/\_/g, '/'); // Convert '_' to '/' - return new Buffer(base64, 'base64'); + return Buffer.from(base64).toString('base64'); }; @@ -74,4 +74,4 @@ exports.validate = function validate(base64) { return /^[A-Za-z0-9\-_]+$/.test(base64); -}; \ No newline at end of file +};