What's the answer? Easy and obvious, just (try to) overwrite the contents
of a file by request from userspace. Filesystems do know where on the
storage they have written the contents to, so why not just let them delete
that stuff themself instead? It's almost unbelievable that this was not
already done in the past 30 years.
Easy, obvious and wrong 8)
The last PC hard disks that were defined to do what you told them where
ST-506 MFM and RLL devices. IDE disks are basically 'disk emulators',
SSDs vastly more so.
An IDE disk can do what it likes with your I/O so long as your requests
and returns are what the standard expects. So for example if you zero a
sector its perfectly entitled to set a bit in a master index of zeroed
sectors. You can't tell the difference and externally it looks like
an ST506 disc with extensions. Even simple devices may well move blocks
around to deal with bad blocks, or high usage spots to avoid having to
keep rewriting the tracks either side.
An SSD internally has minimal relationship to a disc. If you have the
tools to write a file, write over it, discard it and then dump the flash
chips you'll probably find it's still there.
If you plug a Raspberry Pi into a modern large hard disk, the chances are
the smarter end of the cable is the disk.