HH\Lib\OS\mkostemp

Meta Engineer?

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

Create a temporary file using a template filename and the specified open flags

namespace HH\Lib\OS;

function mkostemp(
  string $template,
  int $flags,
): (FileDescriptor, string);

The template must end with exactly 6 X characters; the template may be either a relative or absolute path, however the parent directory must already exist.

This function takes the same flags as OS\open(); like that function, O_CLOEXEC is implied.

The temporary file:

  • will be a new file (i.e. O_CREAT | O_EXCL)
  • be owned by the current user
  • be created with mode 0600

Parameters

  • string $template
  • int $flags

Returns