Using `Stream.toReadableStream` with `Stream.run*` in a NestJS controller

sorry to keep bugging you, but another Stream question - this time about Stream.toReadableStream and how I'm supposed to pair that with Stream.run*. Notably, this is at the intersection of Effect and non-Effect code (specifically a NestJS controller) where I need to return a NestJS "StreamableFile".

I have this code
const readableStream = this.createWordExportStream().pipe(
  Effect.provide(WordGenerator.Default),
  Stream.runDrain,
  Stream.toReadableStream
);

return new StreamableFile(Readable.fromWeb(readableStream as any), {
  type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
  disposition: `attachment; filename="demo.docx"`,
});


For some reason, this just never returns anything. Is there something obvious that I'm missing? The new StreamableFile(Readable.fromWeb(...)) stuff is correct, I'm 99% sure. Interestingly enough, it does work when I change createWordExportStream() to return an Effect<Stream<>> instead of a stream directly, and then I Effect.runPromise() that.
Was this page helpful?