Skip to content

Duplex.from failure #40497

@ronag

Description

@ronag
  pipeline(
    Readable.from('abc\ndef\nghi'),
    Duplex.from(async function * (source) {
      let rest = ''
      for await (const chunk of source) {
        const lines = (rest + chunk.toString()).split('\n')
        rest = lines.pop()
        for (const line of lines) {
          yield line
        }
      }
      yield rest
    }),
    async function * (source) {
      let ret = ''
      for await (const x of source) {
        ret += x
      }
      assert.strictEqual(ret, 'abcdefghi')
    },
    common.mustCall(() => {}),
  )

Replace Duplex.from(arg) with arg and it works...

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.streamIssues and PRs related to the stream subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions