If a macOS/linux process still has a deleted file open, you can recover it entirely using the open file descriptor — even if the file has been deleted from disk!
This guide shows how to do it using mpv
’s IPC interface and embedded Lua scripting. Don't close the mpv
process and hopefully it already has a IPC interface set. The general approach is generic, but you need a way to get the running process itself to perform the fd copy. We take advantage of mpv's ability to run arbitary lua code.