Skip to content

Writer cannot cope with ArrayBuffer #43433

Open
@zhmushan

Description

@zhmushan

Version

v19.0.0-pre

Platform

Darwin

Subsystem

web/streams

What steps will reproduce the bug?

Try the following code both on chrome & nodejs:

const str = "H4sIAAAAAAAAE0vLzwcAIWVzjAMAAAA=";
const buf = Uint8Array.from(atob(str), c => c.charCodeAt(0));
const ds = new DecompressionStream("gzip");
const writer = ds.writable.getWriter();
writer.write(buf.buffer);
writer.close();
await new Response(ds.readable).arrayBuffer();

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

node:internal/errors:477
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of ArrayBuffer
    at new NodeError (node:internal/errors:388:5)
    at _write (node:internal/streams/writable:315:13)
    at Writable.write (node:internal/streams/writable:337:10)
    at Object.write (node:internal/webstreams/adapters:166:63)
    at ensureIsPromise (node:internal/webstreams/util:172:19)
    at writableStreamDefaultControllerProcessWrite (node:internal/webstreams/writablestream:1091:5)
    at writableStreamDefaultControllerAdvanceQueueIfNeeded (node:internal/webstreams/writablestream:1206:5)
    at node:internal/webstreams/writablestream:1278:7 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedIssues that need assistance from volunteers or PRs that need help to proceed.streamIssues and PRs related to the stream subsystem.web streamsweb-standardsIssues and PRs related to Web APIs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions