Automatically clean-up temporary files when processes exit.
On the BEAM the best way to do clean-up is to have it be performed when the process exits, so it is done even if the process exited unexpectedly. This package lets processes register file system paths as belonging to them, so they get deleted on exit.
gleam add process_file@1// Start the process file manager.
// Ideally you would add it to your supervision tree.
let assert Ok(Started(data: manager, ..)) = process_file.start()
// Elsewhere in your code, register file ownership with the manager.
// It'll be deleted when the process that called the function exits.
process_file.register(manager, "/tmp/my-tmp-file1.txt")Further documentation can be found at https://hexdocs.pm/process_file.