Skip to content

webstreams: integrate into common stream utils #39316

Closed
@jasnell

Description

@jasnell

With the introduction of web streams, it would be good to integrate support into the various common stream utilities...

Refs: #39134

/cc @mcollina @ronag

  • stream.finished()
const { finished } = require('stream');
finished(new ReadableStream(), (err) => { /* ... */ });
finished(new WritableStream(), (err) => { /* ... */ });
finished(new TransformStream(), (err) => { /* ... */ });
import { finished } from 'stream/promises';
await finished(new ReadableStream());
await finished(new WritableStream());
await finished(new TransformStream());
  • stream.pipeline()
const { pipeline } = require('stream');
pipeline(new ReadableStream(), new TransformStream(), new WritableStream(), (err) => { /* ... */ });
import { pipeline } from 'stream/promises';
await pipeline(new ReadableStream(), new TransformStream(), new WritableStream());
  • stream.addAbortSignal()
const { addAbortSignal } = require('stream');
const ac = new AbortController();
const readable = new ReadableStream();
addAbortSignal(ac.signal, readable);

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.streamIssues and PRs related to the stream subsystem.web streams

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions