Truncating is discarding the file contents (if the file already exists). So it sets the length to 0.
https://docs.godotengine.org/en/stable/classes/class_file.html
Keep in mind that if you want to append to a file and open it using READ_WRITE you still have to position to the end of file ( i.e. using seek_end() ). If you don't seek then it will start overwriting the contents on the current position (which is the at the position 0 after opening a file).