You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The stream/promises API provides an alternative set of asynchronous utility functions for streams that return Promise objects rather than using callbacks. The API is accessible via require('stream/promises') or require('stream').promises.
Which is fine. However, when using the ESM syntax it does not work like other APIs like 'fs' or 'dns':
import{promisesasfsPromises}from'fs'// no error thrownimport{promisesasdnsPromises}from'dns'// no error thrownimport{promisesasstreamPromises}from'stream'// ^^^^^^^^// SyntaxError: The requested module 'stream' does not provide an export named 'promises'// at ModuleJob._instantiate (internal/modules/esm/module_job.js:98:21)// at async ModuleJob.run (internal/modules/esm/module_job.js:143:5)// at async Loader.import (internal/modules/esm/loader.js:165:24)// at async Object.loadESM (internal/process/esm_loader.js:68:5)
What is the expected behavior?
It should work just like 'fs' or 'dns' promises.
This issue is similar to #21014 or the fix in #32953
What do you see instead?
Throws a SyntaxError.
Additional information
I have made a repo to demonstrate the issue. There are various syntaxes, but 2.js shows the issue pretty well.
The text was updated successfully, but these errors were encountered:
PoojaDurgad
added
esm
Issues and PRs related to the ECMAScript Modules implementation.
stream
Issues and PRs related to the stream subsystem.
labels
Oct 21, 2020
v12.17.0 (current LTS)
v14.14.0 (LTS in a few days)
Linux 5.4.0-51-generic
'stream'
What steps will reproduce the bug?
The documentation says:
Which is fine. However, when using the ESM syntax it does not work like other APIs like 'fs' or 'dns':
What is the expected behavior?
It should work just like 'fs' or 'dns' promises.
This issue is similar to #21014 or the fix in #32953
What do you see instead?
Throws a
SyntaxError
.Additional information
I have made a repo to demonstrate the issue. There are various syntaxes, but
2.js
shows the issue pretty well.The text was updated successfully, but these errors were encountered: