initial commit

This commit is contained in:
2025-06-06 16:47:33 +02:00
commit 6df18eb794
14 changed files with 846 additions and 0 deletions

22
bytechan_writer.go Normal file
View File

@ -0,0 +1,22 @@
package main
import (
"io"
)
func NewWriterFromByteChan(ch chan byte) *ByteChanWriter {
return &ByteChanWriter{ch}
}
type ByteChanWriter struct {
ch chan byte
}
var _ io.Writer = &ByteChanWriter{}
func (w *ByteChanWriter) Write(p []byte) (n int, err error) {
for _, b := range p {
w.ch <- b
}
return len(p), nil
}