-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
The Node driver currently maintains a custom NodeJS stream adapter for cursors. Starting in Node15, NodeJS has a `Readable.from` method which can adapt an async iterator to a NodeJS stream automatically.
We should consider dropping support for this custom type in favor of the NodeJS builtin. Our ReadableStream is an internal type, so it can be removed in any release.
To make this change now, we need to maintain support for Readable.from ourselves. The NodeJS source is available here and looks straightforward to maintain (our implementation would be even simpler, since we would only support async iterables).
Acceptance Criteria
- Implement a custom Readable.from method based on the NodeJS source to use in our cursors. We should only use our polyfilled version if NodeJS <= 15, otherwise we rely on the Node builtin.
- Remove ReadableCursorStream and use Readable.from instead.