Safe Haskell | Safe-Inferred |
---|
Do things with files.
Synopsis
- writeLines :: IO.FilePath -> [Text] -> IO.IO ()
- writeAtomic :: IO.FilePath -> ByteString.ByteString -> IO.IO ()
- symlink :: String -> IO.FilePath -> IO.IO ()
- writable :: IO.FilePath -> IO.IO Bool
- list :: IO.FilePath -> IO.IO [IO.FilePath]
- listRecursive :: (IO.FilePath -> Bool) -> IO.FilePath -> IO.IO [IO.FilePath]
- walk :: (IO.FilePath -> Bool) -> IO.FilePath -> Stream (Of (IO.FilePath, [IO.FilePath])) IO.IO ()
- readGz :: IO.FilePath -> IO.IO (Either String ByteString.ByteString)
- writeGz :: Int -> IO.FilePath -> ByteString.ByteString -> IO.IO Bool
read/write
writeLines :: IO.FilePath -> [Text] -> IO.IO () Source #
writeAtomic :: IO.FilePath -> ByteString.ByteString -> IO.IO () Source #
query
writable :: IO.FilePath -> IO.IO Bool Source #
True if the file doesn't exist, or if it does but is writable.
directory
list :: IO.FilePath -> IO.IO [IO.FilePath] Source #
Like Directory.listDirectory
except prepend the directory and omit
all dot files.
listRecursive :: (IO.FilePath -> Bool) -> IO.FilePath -> IO.IO [IO.FilePath] Source #
walk :: (IO.FilePath -> Bool) -> IO.FilePath -> Stream (Of (IO.FilePath, [IO.FilePath])) IO.IO () Source #
Walk the filesystem and stream (dir, fname).
compression
readGz :: IO.FilePath -> IO.IO (Either String ByteString.ByteString) Source #
Read and decompress a gzipped file.
:: Int | save this many previous versions of the file |
-> IO.FilePath | |
-> ByteString.ByteString | |
-> IO.IO Bool | False if the file wasn't written because it wouldn't have changed. |
Write a gzipped file. Try to do so atomically by writing to a tmp file first and renaming it.
Like mv
, this will refuse to overwrite a file if it isn't writable. If
the file wouldn't have changed, abort the write and delete the tmp file.
The mtime won't change, and the caller gets a False, which can be used to
avoid rebuilds.