Skip to content

joeke80215/safetyrecevier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card License

safetyrecevier

golang package for receiving large file

install

go get -u github.com/joeke80215/safetyrecevier

receive

maxMemoeryBufSize := 4 << 20
safeReceive := softrecevier.New(maxMemoeryBufSize)
defer safeReceive.CloseReceive()

for {
    chunk := make([]byte, 3) // set any chunk size
    n, err := exampleReader.Read(chunk)
    if err := safeReceive.Append(chunk,n);err != nil {
        if err == io.EOF {
            break
        }
    	// handle error
    }
}

read

safeReceive implement io.ReadSeeker interface
example

b, _ := ioutil.ReadAll(safeReceive)
.
.
.

About

golang package for receiving large file

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages