initial commit
This commit is contained in:
25
filehandle.go
Normal file
25
filehandle.go
Normal file
@ -0,0 +1,25 @@
|
||||
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),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user