Copyright | (c) 2018 Composewell Technologies |
---|---|
License | BSD3 |
Maintainer | streamly@composewell.com |
Stability | pre-release |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Streamly.FileSystem.DirIO
Contents
Description
High performance and streaming APIs for reading directories.
File system paths are specified using the Path
type. If you want to convert between String
or FilePath
and Path
use
fromString_
, toString
from the Streamly.FileSystem.Path module..
>>>
import qualified Streamly.FileSystem.DirIO as Dir
Synopsis
- data ReadOptions
- followSymlinks :: Bool -> ReadOptions -> ReadOptions
- ignoreMissing :: Bool -> ReadOptions -> ReadOptions
- ignoreSymlinkLoops :: Bool -> ReadOptions -> ReadOptions
- ignoreInaccessible :: Bool -> ReadOptions -> ReadOptions
- read :: forall (m :: Type -> Type). (MonadIO m, MonadCatch m) => Path -> Stream m Path
- readEither :: forall (m :: Type -> Type). (MonadIO m, MonadCatch m) => (ReadOptions -> ReadOptions) -> Path -> Stream m (Either Path Path)
Configuration
data ReadOptions Source #
Options controlling the behavior of directory read.
followSymlinks :: Bool -> ReadOptions -> ReadOptions Source #
Control how symbolic links are handled when determining the type of a directory entry.
- If set to
True
, symbolic links are resolved before classification. This means a symlink pointing to a directory will be treated as a directory, and a symlink pointing to a file will be treated as a non-directory. - If set to
False
, all symbolic links are classified as non-directories, without attempting to resolve their targets.
Enabling resolution may cause additional errors to occur due to insufficient permissions, broken links, or symlink loops. Such errors can be ignored or handled using the appropriate options.
The default is False
.
On Windows this option has no effect as of now, symlinks are not followed to determine the type.
ignoreMissing :: Bool -> ReadOptions -> ReadOptions Source #
When the followSymlinks
option is enabled and a directory entry is a
symbolic link, we resolve it to determine the type of the symlink target.
This option controls the behavior when encountering broken symlink errors
during resolution.
When set to True
, broken symlink errors are ignored, and the type of the
entry is reported as not a directory. When set to False
, the directory
read operation fails with an error.
The default is True
.
On Windows this option has no effect as of now, symlinks are not followed to determine the type.
ignoreSymlinkLoops :: Bool -> ReadOptions -> ReadOptions Source #
When the followSymlinks
option is enabled and a directory entry is a
symbolic link, we resolve it to determine the type of the symlink target.
This option controls the behavior when encountering symlink loop errors
during resolution.
When set to True
, symlink loop errors are ignored, and the type of the
entry is reported as not a directory. When set to False
, the directory
read operation fails with an error.
The default is True
.
On Windows this option has no effect as of now, symlinks are not followed to determine the type.
ignoreInaccessible :: Bool -> ReadOptions -> ReadOptions Source #
When the followSymlinks
option is enabled and a directory entry is a
symbolic link, we resolve it to determine the type of the symlink target.
This option controls the behavior when encountering permission errors
during resolution.
When set to True
, any permission errors are ignored, and the type of the
entry is reported as not a directory. When set to False
, the directory
read operation fails with an error.
The default is True
.
On Windows this option has no effect as of now, symlinks are not followed to determine the type.
Streams
read :: forall (m :: Type -> Type). (MonadIO m, MonadCatch m) => Path -> Stream m Path Source #
Raw read of a directory.
Pre-release
readEither :: forall (m :: Type -> Type). (MonadIO m, MonadCatch m) => (ReadOptions -> ReadOptions) -> Path -> Stream m (Either Path Path) Source #
Read directories as Left and files as Right. Filter out "." and ".." entries. The output contains the names of the directories and files.
Pre-release