feat: Implement Truncate

This commit is contained in:
Felix Pojtinger
2021-12-23 21:25:34 +01:00
parent 7e0386c520
commit b4c8925299

View File

@@ -193,7 +193,16 @@ func (f *File) Truncate(size int64) error {
return ErrIsDirectory
}
return ErrNotImplemented
f.ioLock.Lock()
defer f.ioLock.Unlock()
if f.writeBuf == nil {
f.writeBuf = filebuffer.New([]byte{})
}
f.writeBuf.Buff.Truncate(f.writeBuf.Buff.Len())
return nil
}
func (f *File) WriteString(s string) (ret int, err error) {