You can’t really modify it that way – file systems don’t generally let you insert data in arbitrary locations – but you can:
- Create a new file
- Write the prefix to it
- Copy the data from the old file to the new file
- Move the old file to a backup location
- Move the new file to the old file’s location
- Optionally delete the old backup file