fix(smartduplex): Enhance documentation for read function in SmartDuplex
This commit is contained in:
@@ -56,6 +56,10 @@ export class SmartDuplex<TInput = any, TOutput = any> extends Duplex {
|
||||
readableStream: ReadableStream<T>
|
||||
): SmartDuplex<T, T> {
|
||||
const smartDuplex = new SmartDuplex<T, T>({
|
||||
/**
|
||||
* this function is called whenever the stream is being read from and at the same time if nothing is enqueued
|
||||
* therefor it is important to always unlock the reader after reading
|
||||
*/
|
||||
readFunction: async () => {
|
||||
const reader = readableStream.getReader();
|
||||
const { value, done } = await reader.read();
|
||||
|
||||
Reference in New Issue
Block a user