createTempFile function

  1. @Deprecated('Avoid creating temporary files in the default temp location ' 'with this function due to too wide permissions on the newly created file. ' 'Use kotlin.io.path.createTempFile instead or resort to java.io.File.createTempFile.')
File createTempFile({
  1. String prefix = 'tmp',
  2. String? suffix,
  3. File? directory,
})

Creates a new empty file in the specified directory, using the given prefix and suffix to generate its name.

Implementation

@Deprecated(
  'Avoid creating temporary files in the default temp location '
  'with this function due to too wide permissions on the newly created file. '
  'Use kotlin.io.path.createTempFile instead or resort to java.io.File.createTempFile.',
)
File createTempFile({
  String prefix = 'tmp',
  String? suffix,
  File? directory,
}) {
  return File(
    '${directory?.path ?? ''}/$prefix${suffix ?? ''}',
  );
}