File is deleted on write to ensure it does not continuously grow

This commit is contained in:
zontreck 2024-05-24 15:43:47 -07:00
parent 86ae7ad4aa
commit 0a5d99cd6f
3 changed files with 7 additions and 1 deletions

View file

@ -210,6 +210,8 @@ class ByteLayer {
Future<void> writeToFile(String filePath) async {
final file = File(filePath);
if (file.existsSync())
file.deleteSync(); // Ensure we flush the file to 0 bytes
await file.writeAsBytes(bytes);
}