Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ammario/prefixsuffix
Exported os/exec.prefixSuffixSaver
https://github.com/ammario/prefixsuffix
Last synced: 25 days ago
JSON representation
Exported os/exec.prefixSuffixSaver
- Host: GitHub
- URL: https://github.com/ammario/prefixsuffix
- Owner: ammario
- License: mit
- Created: 2020-04-05T18:37:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-05T19:17:52.000Z (over 4 years ago)
- Last Synced: 2024-05-21T05:54:26.550Z (6 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prefixsuffix
[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/ammario/prefixsuffix)Exported [os/exec.prefixSuffixSaver](https://golang.org/src/os/exec/exec.go?s=19091:19652#L649).
```go
// Saver is an io.Writer which retains the first N bytes
// and the last N bytes written to it. The Bytes() methods reconstructs
// it with a pretty error message.
type Saver struct {
N int // max size of prefix or suffix
// ...
}
```## Basic Usage
```go
func something() {
s := &prefixsuffix.Saver{N: 4}
io.WriteString(s, "1234 --- 5678")
fmt.Printf("%s\n", s.Bytes())
// 1234
// ... omitting 5 bytes ...
// 5678
}
```