Skip to content

structured types do not make it to NodeJS in ReadableStream #2826

@insipx

Description

@insipx

Following up from an issue posted about in the community discord (link). It seems like ReadableStreams work well for byte arrays, but when trying to send Napi Rust Objects into the stream, nothing comes out in NodeJS.

I first experienced this when attempting to upgrade to napi-3.0 here: xmtp/libxmtp#2160 however was able to reproduce in my napi-rs fork with the stream tests here: https://github.com/insipx/napi-rs/blob/ee3d94c3b5e569c931f90298dfe11174eca889c7/examples/napi/src/stream.rs#L65

In this test, we are starting a tokio thread sending Foo into a receiver that is used to create the Napi ReadableStream type. The companion test in NodeJS for this is here

When running the NodeJS test, nothing gets sent to the stream

The working napi test is here. Difference being the 'create_with_stream_bytes' method is being used, and we do receive the bytes in NodeJS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions