-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regression: Apps-Engine - Convert streams to buffers on file upload (#…
…20523) Co-authored-by: Diego Sampaio <chinello@gmail.com>
- Loading branch information
1 parent
2c81c0e
commit d420c21
Showing
6 changed files
with
25 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Readable } from 'stream'; | ||
|
||
export const streamToBuffer = (stream: Readable): Promise<Buffer> => new Promise((resolve) => { | ||
const chunks: Array<Buffer> = []; | ||
|
||
stream | ||
.on('data', (data) => chunks.push(data)) | ||
.on('end', () => resolve(Buffer.concat(chunks))) | ||
// force stream to resume data flow in case it was explicitly paused before | ||
.resume(); | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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