Skip to content

Commit

Permalink
fix: patch TransformStream on Node.js 16
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Dec 11, 2024
1 parent b5dccce commit ef8bc3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { randomBytes, createHash } from 'node:crypto';
import { Readable } from 'node:stream';
import { performance } from 'node:perf_hooks';
import { ReadableStream } from 'node:stream/web';
import { ReadableStream, TransformStream } from 'node:stream/web';
import { Blob } from 'node:buffer';
import type { FixJSONCtlChars } from './Request.js';
import { SocketInfo } from './Response.js';
Expand Down Expand Up @@ -216,6 +216,11 @@ export function patchForNode16() {
// @ts-ignore
global.ReadableStream = ReadableStream;
}
if (typeof global.TransformStream === 'undefined') {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
global.TransformStream = TransformStream;
}
if (typeof global.Blob === 'undefined') {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand Down

0 comments on commit ef8bc3a

Please sign in to comment.