Readable.toWeb
seems to load file contents to memory #46347
Closed
Description
opened on Jan 25, 2023
Version
v19.5.0
Platform
Darwin dzieni 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101 arm64
Subsystem
stream
What steps will reproduce the bug?
- run REPL
- create a file stream:
const nodeStream = fs.createReadStream('/some/large/file')
- check
process.memoryUsage()
- convert it to a web stream:
const webStream = (require('stream').Readable).toWeb(nodeStream)
- check
process.memoryUsage()
How often does it reproduce? Is there a required condition?
At all times
What is the expected behavior?
Memory usage does not grow significantly.
What do you see instead?
Memory usage (precisely arrayBuffers
section) grows by a few orders of magnitude. It seems to be correlated with the file size.
Additional information
No response
Activity