Skip to content

Commit

Permalink
use class inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Sep 20, 2024
1 parent 6536d64 commit 4182927
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,13 @@ export const createChecksumStream = ({
return readable;
};

const ReadableStreamRef = typeof ReadableStream === "function" ? ReadableStream : function (): void {};

/**
* This stub exists so that the readable returned by createChecksumStream
* identifies as "ChecksumStream" in alignment with the Node.js
* implementation.
*
* @extends ReadableStream
*/
export function ChecksumStream(): void {}

if (typeof ReadableStream === "function") {
ChecksumStream.prototype = Object.create(ReadableStream.prototype);
ChecksumStream.prototype.constructor = ChecksumStream;
}
export class ChecksumStream extends (ReadableStreamRef as any) {}

0 comments on commit 4182927

Please sign in to comment.