Safe Haskell | Safe-Inferred |
---|
System.IO.Temp
- withSystemTempFile :: String -> (FilePath -> Handle -> IO a) -> IO a
- withSystemTempDirectory :: String -> (FilePath -> IO a) -> IO a
- withTempFile :: FilePath -> String -> (FilePath -> Handle -> IO a) -> IO a
- withTempDirectory :: FilePath -> String -> (FilePath -> IO a) -> IO a
- openTempFile :: FilePath -> String -> IO (FilePath, Handle)
- openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle)
- openNewBinaryFile :: FilePath -> String -> IO (FilePath, Handle)
- createTempDirectory :: FilePath -> String -> IO FilePath
Documentation
Arguments
:: String | File name template. See |
-> (FilePath -> Handle -> IO a) | Callback that can use the file |
-> IO a |
Create and use a temporary directory in the system standard temporary directory.
Behaves exactly the same as withTempDirectory
, except that the parent temporary directory
will be that returned by getTemporaryDirectory
.
Arguments
:: String | Directory name template. See |
-> (FilePath -> IO a) | Callback that can use the directory |
-> IO a |
Create and use a temporary directory in the system standard temporary directory.
Behaves exactly the same as withTempDirectory
, except that the parent temporary directory
will be that returned by getTemporaryDirectory
.
Arguments
:: FilePath | Temp dir to create the file in |
-> String | File name template. See |
-> (FilePath -> Handle -> IO a) | Callback that can use the file |
-> IO a |
Use a temporary filename that doesn't already exist.
Creates a new temporary file inside the given directory, making use of the template. The temp file is deleted after use. For example:
withTempFile "src" "sdist." $ \tmpFile hFile -> do ...
The tmpFlie
will be file in the given directory, e.g.
src/sdist.342
.
Arguments
:: FilePath | Temp directory to create the directory in |
-> String | Directory name template. See |
-> (FilePath -> IO a) | Callback that can use the directory |
-> IO a |
Create and use a temporary directory.
Creates a new temporary directory inside the given directory, making use of the template. The temp directory is deleted after use. For example:
withTempDirectory "src" "sdist." $ \tmpDir -> do ...
The tmpDir
will be a new subdirectory of the given directory, e.g.
src/sdist.342
.
openTempFile :: FilePath -> String -> IO (FilePath, Handle)
openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle)
openNewBinaryFile :: FilePath -> String -> IO (FilePath, Handle)
createTempDirectory :: FilePath -> String -> IO FilePath