unix-2.6.0.1: POSIX functionality

Portability | non-portable (requires POSIX)
Stability | provisional
Maintainer | libraries@haskell.org, vs@foldr.org, deian@cs.stanford.edu
Safe Haskell | Trustworthy

System.Posix.Temp.ByteString

Description

POSIX temporary file and directory creation functions.

Synopsis

- mkstemp :: ByteString -> IO (RawFilePath, Handle)
- mkstemps :: ByteString -> ByteString -> IO (RawFilePath, Handle)
- mkdtemp :: ByteString -> IO RawFilePath

# Documentation

mkstemp :: ByteString -> IO (RawFilePath, Handle)

Make a unique filename and open it for reading/writing. The returned `RawFilePath` is the (possibly relative) path of the created file, which is padded with 6 random characters. The argument is the desired prefix of the filepath of the temporary file to be created.

If you aren't using GHC or Hugs then this function simply wraps mktemp and so shouldn't be considered safe.

mkstemps :: ByteString -> ByteString -> IO (RawFilePath, Handle)

`mkstemps` - make a unique filename with a given prefix and suffix and open it for reading/writing (only safe on GHC & Hugs). The returned `RawFilePath` is the (possibly relative) path of the created file, which contains 6 random characters in between the prefix and suffix.

mkdtemp :: ByteString -> IO RawFilePath

Make a unique directory. The returned `RawFilePath` is the path of the created directory, which is padded with 6 random characters. The argument is the desired prefix of the filepath of the temporary directory to be created.

If you aren't using GHC or Hugs then this function simply wraps mktemp and so shouldn't be considered safe.