organizer/filehandle.go

26 lines
351 B
Go
Raw Normal View History

2023-01-15 19:43:36 +01:00
package main
import (
"io"
)
type FileHandle struct {
File string
Chan chan byte
Writer io.Writer
}
func (fh *FileHandle) Close() error {
close(fh.Chan)
return nil
}
func NewFileHandle(path string) *FileHandle {
out := make(chan byte, 4096)
return &FileHandle{
File: path,
Chan: out,
Writer: NewWriterFromByteChan(out),
}
}