We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2c378bb commit d9b973aCopy full SHA for d9b973a
arduino/utils/stream.go
@@ -22,7 +22,10 @@ import (
22
)
23
24
// FeedStreamTo creates a pipe to pass data to the writer function.
25
-// FeedStreamTo returns the io.Writer side of the pipe, on which the user can write data
+// FeedStreamTo returns the io.WriteCloser side of the pipe, on which the user can write data.
26
+// The user must call Close() on the returned io.WriteCloser to release all the resources.
27
+// If needed, the context can be used to detect when all the data has been processed after
28
+// closing the writer.
29
func FeedStreamTo(writer func(data []byte)) (io.WriteCloser, context.Context) {
30
ctx, cancel := context.WithCancel(context.Background())
31
r, w := io.Pipe()
0 commit comments