diff --git a/lib/internal/blob.js b/lib/internal/blob.js index 8014a1bb5b0349..397bffabba7b5a 100644 --- a/lib/internal/blob.js +++ b/lib/internal/blob.js @@ -78,6 +78,7 @@ let ReadableStream; let URL; const enc = new TextEncoder(); +let dec; // Yes, lazy loading is annoying but because of circular // references between the url, internal/blob, and buffer @@ -311,7 +312,8 @@ class Blob { if (!isBlob(this)) throw new ERR_INVALID_THIS('Blob'); - const dec = new TextDecoder(); + dec ??= new TextDecoder(); + return dec.decode(await this.arrayBuffer()); }