Meta Engineer?

This is available as OS\mkdtemp in the www repository.

Create a temporary directory

namespace HH\Lib\OS;

function mkdtemp(
  string $template,
): string;

This function creates a new, unique temporary directory, with the name matching the provided template, and returns the path. The directory will be created with permissions 0700.

The template MUST end with XXXXXX; these are replaced with random printable characters to create a unique name. While some platforms are more flexible, the HSL always requires this for consistency. Any additional trailing Xs may result in literal X's (e.g. glibc), or in additional randomness (e.g. BSD) - use a separator (e.g. fooXXX.XXXXXX) to guarantee any characters are preserved.


  • string $template


  • string