From 269e0051985e9530e145f6a25e8bb08ccebf1c07 Mon Sep 17 00:00:00 2001 From: Rahul Padigela Date: Wed, 16 Dec 2020 17:52:15 -0800 Subject: [PATCH] improvement: S3C-3727 update deprecated Buffer usage --- lib/storage/data/external/PfsClient.js | 2 +- tests/utils/mdProxyUtils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/storage/data/external/PfsClient.js b/lib/storage/data/external/PfsClient.js index 3f42c2779..b1485bd9c 100644 --- a/lib/storage/data/external/PfsClient.js +++ b/lib/storage/data/external/PfsClient.js @@ -41,7 +41,7 @@ class PfsClient { const b64 = keyContext.metaHeaders['x-amz-meta-md5chksum']; let md5 = null; if (b64) { - md5 = new Buffer(b64, 'base64').toString('hex'); + md5 = Buffer.from(b64, 'base64').toString('hex'); } return callback(null, keyContext.objectKey, '', keyContext.metaHeaders['x-amz-meta-size'], diff --git a/tests/utils/mdProxyUtils.js b/tests/utils/mdProxyUtils.js index e3cd13e01..91efdb840 100644 --- a/tests/utils/mdProxyUtils.js +++ b/tests/utils/mdProxyUtils.js @@ -63,7 +63,7 @@ class DummyProxyRequest { this.method = params.method; this.url = params.url; this.json = params.json; - this.body = new Buffer( + this.body = Buffer.from( this.json ? JSON.stringify(params.body) : (params.body || '')); this.headers = params.headers; this.socket = {