Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/backends/srndv2/src/srnd/line.go

24 lines
335 B
Go
Raw Normal View History

package srnd
import (
"bytes"
"io"
)
type LineWriter struct {
w io.Writer
}
func NewLineWriter(w io.Writer) *LineWriter {
return &LineWriter{
w: w,
}
}
func (l *LineWriter) Write(data []byte) (n int, err error) {
n = len(data)
data = bytes.Replace(data, []byte{13, 10}, []byte{10}, -1)
_, err = l.w.Write(data)
return
}