-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support Node 16, workaround pipeline bug
Workaround nodejs/node#40191
- Loading branch information
1 parent
c82ac8f
commit 3640c12
Showing
6 changed files
with
19 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
import { pipeline } from 'stream' | ||
import { promisify } from 'util' | ||
|
||
type AnyStream = NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream | ||
|
||
/** | ||
* Promisified stream.pipeline() | ||
*/ | ||
export const _pipeline = promisify(pipeline) | ||
export let _pipeline = promisify(pipeline) | ||
|
||
// Workaround https://github.com/nodejs/node/issues/40191 | ||
// todo: remove it when fix is released in 16.x and in AppEngine 16.x | ||
if (process.version > 'v16.13') { | ||
const { pipeline } = require('stream/promises') | ||
_pipeline = ((streams: AnyStream[]) => pipeline(...streams)) as any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters