From 1da2270af73e59a74394dd340f361c6e82e4160b Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Wed, 10 Aug 2022 16:49:12 +0200 Subject: [PATCH] Missed a name change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff8cb26..ce82ef2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ TODO In Node.js streams, there is a thing called a Duplex stream. This is basically a stream that has an independent readable and writable part, that are not connected together. Like a TCP socket, for example; you send data through the writable half and receive data through the readable half - but the data you receive is not the same data as you sent. -Duplex streams are really just two independent streams that are stuffed into a single object, representing a single resource, like a network socket. And this is how ppstreams treats those - as two independent streams. In Promistreams, there are no Duplex streams, so when converting a Node.js Duplex stream, you will have to do the conversion twice - once for the readable part, and once for the writable part. This can be done with the `duplexRead` and `duplexWrite` methods. +Duplex streams are really just two independent streams that are stuffed into a single object, representing a single resource, like a network socket. And this is how Promistreams treats those - as two independent streams. In Promistreams, there are no Duplex streams, so when converting a Node.js Duplex stream, you will have to do the conversion twice - once for the readable part, and once for the writable part. This can be done with the `duplexRead` and `duplexWrite` methods. __Why does Promistreams not have Duplex streams?__ Because they're surprisingly tricky to implement. They would make the Promistreams specification a lot more complex, and make certain things impossible; for example, a sink stream (writable stream) in Promistreams can return a Promise to signify when it's completely done receiving data, but a source stream (readable stream) needs to return a Promise with the next read value! You can only return one or the other, so supporting both would involve a lot of special logic for detecting what kind of thing is being returned.