Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions ext/node/polyfills/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export {
getDefaultHighWaterMark,
PassThrough,
pipeline,
promises,
Readable,
setDefaultHighWaterMark,
Stream,
Expand Down
22 changes: 21 additions & 1 deletion tests/unit_node/stream_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
import { assert, assertEquals } from "@std/assert";
import { fromFileUrl, relative } from "@std/path";
import { finished, pipeline } from "node:stream/promises";
import { getDefaultHighWaterMark, Stream, Writable } from "node:stream";
import {
getDefaultHighWaterMark,
promises,
Stream,
Writable,
} from "node:stream";
import { TextEncoderStream } from "node:stream/web";
import { createReadStream, createWriteStream } from "node:fs";
import { EventEmitter } from "node:events";
Expand Down Expand Up @@ -78,3 +83,18 @@ Deno.test("Writable toWeb", async () => {

await finished(nodeWritable);
});

// https://github.com/denoland/deno/issues/30423
Deno.test("exported `promises` from node:stream works", async () => {
const stream = new ReadableStream({
start(controller) {
controller.enqueue("asd");
controller.close();
},
});
const promise = promises.finished(stream as unknown as NodeJS.ReadableStream);
for await (const chunk of stream) {
assertEquals(chunk, "asd");
}
await promise;
});
2 changes: 1 addition & 1 deletion tools/core_import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"ext:deno_node/repl.ts": "../ext/node/polyfills/repl.ts",
"node:stream": "../ext/node/polyfills/stream.ts",
"node:stream/consumers": "../ext/node/polyfills/stream/consumers.mjs",
"node:stream/promises": "../ext/node/polyfills/stream/promises.mjs",
"node:stream/promises": "../ext/node/polyfills/stream/promises.js",
"node:stream/web": "../ext/node/polyfills/stream/web.ts",
"node:string_decoder": "../ext/node/polyfills/string_decoder.ts",
"node:sys": "../ext/node/polyfills/sys.ts",
Expand Down
Loading