You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And if we'd like to send the output to the terminal *as well as* to the file, we can do that:
107
+
108
+
```go
109
+
script.Echo("data").Tee().AppendFile("data.txt")
110
+
```
111
+
105
112
We're not limited to getting data only from files or standard input. We can get it from HTTP requests too:
106
113
107
114
```go
@@ -304,6 +311,7 @@ Filters are methods on an existing pipe that also return a pipe, allowing you to
304
311
|[`Replace`](https://pkg.go.dev/github.com/bitfield/script#Pipe.Replace)| matching text replaced with given string |
305
312
|[`ReplaceRegexp`](https://pkg.go.dev/github.com/bitfield/script#Pipe.ReplaceRegexp)| matching text replaced with given string |
306
313
|[`SHA256Sums`](https://pkg.go.dev/github.com/bitfield/script#Pipe.SHA256Sums)| SHA-256 hashes of each listed file |
314
+
|[`Tee`](https://pkg.go.dev/github.com/bitfield/script#Pipe.Tee)| input copied to supplied writers |
307
315
308
316
Note that filters run concurrently, rather than producing nothing until each stage has fully read its input. This is convenient for executing long-running comands, for example. If you do need to wait for the pipeline to complete, call [`Wait`](https://pkg.go.dev/github.com/bitfield/script#Pipe.Wait).
309
317
@@ -328,6 +336,7 @@ Sinks are methods that return some data from a pipe, ending the pipeline and ext
0 commit comments