Portability | portable |
---|---|
Maintainer | jmillikin@gmail.com |
- type Handle = Handle
- type Mode = IOMode
- openFile :: FilePath -> Mode -> IO Handle
- withFile :: FilePath -> Mode -> (Handle -> IO a) -> IO a
- readFile :: FilePath -> IO ByteString
- writeFile :: FilePath -> ByteString -> IO ()
- appendFile :: FilePath -> ByteString -> IO ()
- openTextFile :: FilePath -> Mode -> IO Handle
- withTextFile :: FilePath -> Mode -> (Handle -> IO a) -> IO a
- readTextFile :: FilePath -> IO Text
- writeTextFile :: FilePath -> Text -> IO ()
- appendTextFile :: FilePath -> Text -> IO ()
Documentation
Binary files
withFile :: FilePath -> Mode -> (Handle -> IO a) -> IO aSource
Open a file in binary mode, and pass its Handle
to a provided
computation. The Handle
will be automatically closed when the
computation returns.
See: withBinaryFile
readFile :: FilePath -> IO ByteStringSource
Read in the entire contents of a binary file.
See: readFile
writeFile :: FilePath -> ByteString -> IO ()Source
Replace the entire contents of a binary file with the provided
ByteString
.
See: writeFile
appendFile :: FilePath -> ByteString -> IO ()Source
Append a ByteString
to a file. If the file does not exist, it will
be created.
See: appendFile
Text files
appendTextFile :: FilePath -> Text -> IO ()Source
Append Text
to a file. If the file does not exist, it will
be created.
See: appendFile