CliSubprocessCore.EphemeralFile (CliSubprocessCore v0.4.1)

Copy Markdown View Source

Secure, owner-tracked materialization of one temporary file.

The file is created exclusively in the operating-system temporary directory, restricted to mode 0600, and registered with CliSubprocessCore.EphemeralFiles. The returned teardown is idempotent; the tracker independently removes the file if its owning process dies.

Summary

Functions

Writes already-encoded iodata to a new owner-only temporary file.

Types

cleanup()

@type cleanup() :: (-> :ok)

option()

@type option() :: {:owner, pid()} | {:prefix, String.t()} | {:suffix, String.t()}

Functions

create(iodata, opts \\ [])

@spec create(iodata(), [option()]) :: {:ok, Path.t(), cleanup()} | {:error, term()}

Writes already-encoded iodata to a new owner-only temporary file.

Prefixes and suffixes are bounded filename components. Paths and directories are not accepted as naming options, keeping cleanup limited to one generated file.