Skip to content

Commit

Permalink
stream: add Symbol.toStringTag to Compression Streams
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Nov 13, 2023
1 parent 0304da2 commit 05a536e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/internal/webstreams/compression.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const {
ObjectDefineProperties,
SymbolToStringTag,
} = primordials;

const {
Expand Down Expand Up @@ -137,11 +138,21 @@ class DecompressionStream {
ObjectDefineProperties(CompressionStream.prototype, {
readable: kEnumerableProperty,
writable: kEnumerableProperty,
[SymbolToStringTag]: {
__proto__: null,
configurable: true,
value: 'CompressionStream',
},
});

ObjectDefineProperties(DecompressionStream.prototype, {
readable: kEnumerableProperty,
writable: kEnumerableProperty,
[SymbolToStringTag]: {
__proto__: null,
configurable: true,
value: 'DecompressionStream',
},
});

module.exports = {
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-whatwg-webstreams-compression.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ async function test(format) {
const gzip = new CompressionStream(format);
const gunzip = new DecompressionStream(format);

assert.strictEqual(gzip[Symbol.toStringTag], 'CompressionStream');
assert.strictEqual(gunzip[Symbol.toStringTag], 'DecompressionStream');

gzip.readable.pipeTo(gunzip.writable).then(common.mustCall());

const reader = gunzip.readable.getReader();
Expand Down

0 comments on commit 05a536e

Please sign in to comment.