Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/reference/streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,15 @@ stream.on('data', (chunk) => { console.log(chunk.toString()); });

The [`NodeStream`](./dotnet/Microsoft.JavaScript.NodeApi.Interop/NodeStream) class provides the
.NET `Stream` adapter over a Node.js `Duplex`, `Readable`, or `Writable` stream.

When [building a module using C# Native AOT](../scenarios/js-aot-module), the Node API module needs
the `require()` function at initialization time to load the `node:stream` module. This must be
provided via a global variable *before* loading the AOT module itself.

```JS
global.node_api_dotnet = { require };
const Example = require(...);

const stream = Example.getContent();
stream.on('data', (chunk) => { console.log(chunk.toString()); });
```