feat: Add function that writes to a file without expanding the buffer and closes the file.

This commit is contained in:
Elim Tsiagbey committed 2024-01-11 09:58:32 -05:00
1 parent 366128f079
commit cae97fcd2e
12 files changed
+253 -34

No files matched your search

+9 -1
View File
@@ -55,8 +55,8 @@ type Container interface {
// File represents a storage File.
type File interface {
fs.File
io.Writer
io.StringWriter
Writer
}
// TempFile is a temporary File. It will get removed when Closed.
@@ -64,3 +64,11 @@ type TempFile interface {
File
io.Seeker
}
// Writer is an interface that extends the io.Writer interface with an additional
// WriteAndClose method. WriteAndClose writes a byte slice and closes the file in
// a single call.
type Writer interface {
io.Writer
WriteAndClose([]byte) (int, error)
}