Skip to content

Commit

Permalink
buffer: expose Blob as a global
Browse files Browse the repository at this point in the history
`Blob` is defined as a global in the spec. We have WPT's for it,
and it's graduated experimental. Time to expose it as a global.

Signed-off-by: James M Snell <jasnell@gmail.com>
  • Loading branch information
jasnell committed Dec 21, 2021
1 parent a7bc0c9 commit 02affc8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/api/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ added: v17.3.0

If `abortSignal.aborted` is `true`, throws `abortSignal.reason`.

## Class: `Blob`

<!-- YAML
added: REPLACEME
-->

<!-- type=global -->

See {Blob}.

## Class: `Buffer`

<!-- YAML
Expand Down
7 changes: 7 additions & 0 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ function setupGlobalProxy() {

function setupBuffer() {
const {
Blob,
Buffer,
atob,
btoa,
Expand All @@ -456,6 +457,12 @@ function setupBuffer() {
delete bufferBinding.zeroFill;

ObjectDefineProperties(globalThis, {
'Blob': {
value: Blob,
enumerable: false,
writable: true,
configurable: true,
},
'Buffer': {
value: Buffer,
enumerable: false,
Expand Down

0 comments on commit 02affc8

Please sign in to comment.