# add BufferedTee · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/d9950298444c3a3c9d2e5ec7efbf45e722bbed02)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: d9950298444c3a3c9d2e5ec7efbf45e722bbed02

Requested commit: d9950298444c3a3c9d2e5ec7efbf45e722bbed02

Commit: d9950298444c3a3c9d2e5ec7efbf45e722bbed02

Tree: 7b59aa80aa28946b42b3f223b4efe7b7898696c3

Author: Igor Anić

Committer: Igor Anić

## Message

```
add BufferedTee

BufferedTee provides reader interface to the consumer. Data read by consumer
is also written to the output. Output is hold lookahead_size bytes behind
consumer. Allowing consumer to put back some bytes to be read again. On flush
all consumed bytes are flushed to the output.

      input   ->   tee   ->   consumer
                    |
                 output

input - underlying unbuffered reader
output - writer, receives data read by consumer
consumer - uses provided reader interface

If lookahead_size is zero output always has same bytes as consumer.

```

## Parents

- [955fd65cb1705d8279eb195bdbc69810df1b1d98](https://git.cafe/gitcafe/zig/commit/955fd65cb1705d8279eb195bdbc69810df1b1d98?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/d9950298444c3a3c9d2e5ec7efbf45e722bbed02?format=markdown)
