Simple and naïve throttle writer for go.
package main
import (
"fmt"
"os"
"time"
"github.com/aisk/throttlewriter"
)
func main() {
writer := throttlewriter.New(os.Stdout, 10, time.Second)
i := 0
for {
i++
fmt.Fprintln(writer, i)
}
}
$ go run example.go
1
2
3
4
5
4383562
4383563
8795986
8795987
13150686
13150687
^Csignal: interrupt
Licensed under either of
- MIT license (LICENSE or http://opensource.org/licenses/MIT)
at your option.