Last active
January 14, 2021 12:56
-
-
Save jsidew/1baedfa2aec96ae756d774b471b4918d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type buffer struct { | |
Path string | |
buf *aws.WriteAtBuffer | |
} | |
func (b *buffer) WriteAt(p []byte, off int64) (n int, err error) { | |
if b.buf == nil { | |
b.buf = &aws.WriteAtBuffer{} | |
} | |
return b.buf.WriteAt(p, off) | |
} | |
func (b *buffer) Save() (n int, err error) { | |
if b.buf == nil { | |
return | |
} | |
var f *os.File | |
f, err = os.Create(b.Path) | |
if err != nil { | |
return | |
} | |
defer f.Close() | |
n, err = f.Write(b.buf.Bytes()) | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment