From a3042062d872b4e30f9f396339d5cb8e4ddb9b8c Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 15 Jun 2019 14:45:09 -0700 Subject: [PATCH] add a File struct Signed-off-by: Jeff Carr --- structs.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 structs.go diff --git a/structs.go b/structs.go new file mode 100644 index 0000000..22f8a1e --- /dev/null +++ b/structs.go @@ -0,0 +1,31 @@ +package shell + +import "io" +import "bufio" +import "bytes" +import "github.com/svent/go-nbreader" + +var FileMap map[string]*File + +var readBufferSize int + +type File struct { + Name string + BufferSize int + FbytesBuffer bytes.Buffer + Fbytes []byte + + Fio io.ReadCloser // := process.StdoutPipe() + Fbufio *bufio.Reader // := bufio.NewReader(pOUT) + Fnbreader *nbreader.NBReader // := nbreader.NewNBReader(readOUT, 1024) +} + +func FileCreate(f io.ReadCloser) *File { + var newfile File + + newfile.Fio = f + newfile.Fbufio = bufio.NewReader(f) + newfile.Fnbreader = nbreader.NewNBReader(newfile.Fbufio, 1024) + + return &newfile +}