File: README.md

package info (click to toggle)
golang-github-armon-circbuf 0.0~git20150827.0.bbbad09-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 64 kB
  • sloc: makefile: 2
file content (28 lines) | stat: -rw-r--r-- 611 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
circbuf
=======

This repository provides the `circbuf` package. This provides a `Buffer` object
which is a circular (or ring) buffer. It has a fixed size, but can be written
to infinitely. Only the last `size` bytes are ever retained. The buffer implements
the `io.Writer` interface.

Documentation
=============

Full documentation can be found on [Godoc](http://godoc.org/github.com/armon/circbuf)

Usage
=====

The `circbuf` package is very easy to use:

```go
buf, _ := NewBuffer(6)
buf.Write([]byte("hello world"))

if string(buf.Bytes()) != " world" {
    panic("should only have last 6 bytes!")
}

```