26 lines
351 B
Go
26 lines
351 B
Go
|
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),
|
||
|
}
|
||
|
}
|