From 5d32ca42dacd41f00abad499a8bacd06c203fba6 Mon Sep 17 00:00:00 2001 From: Alicia Lopez Date: Mon, 25 Apr 2022 13:15:44 +0200 Subject: [PATCH] fix: use res.arrayBuffer() instead of res.buffer() (#624) This fixes a DeprecationWarning when using git node wpt. --- lib/request.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/request.js b/lib/request.js index b1f9fc0..6002da6 100644 --- a/lib/request.js +++ b/lib/request.js @@ -37,7 +37,9 @@ export default class Request { } async buffer(url, options = {}) { - return this.fetch(url, options).then(res => res.buffer()); + const res = await this.fetch(url, options); + const buffer = await res.arrayBuffer(); + return Buffer.from(buffer); } async text(url, options = {}) {