streamly-core
Copyright(c) 2024 Composewell Technologies
LicenseBSD3
Maintainerstreamly@composewell.com
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Streamly.Internal.FileSystem.Posix.ReadDir

Description

 
Synopsis

Documentation

readScanWith_ :: forall (m :: Type -> Type) a. Scanl m (Path, CString) a -> (ReadOptions -> ReadOptions) -> Path -> Stream m a Source #

Minimal read without any metadata.

readScanWith :: forall (m :: Type -> Type) a. Scanl m (Path, CString, Ptr CDirent) a -> (ReadOptions -> ReadOptions) -> Path -> Stream m a Source #

Read with essential metadata. The scan takes the parent dir, the child name, the child metadata and produces an output. The scan can do filtering, formatting of the output, colorizing the output etc.

The options are to ignore errors encountered when reading a path, turn the errors into a nil stream instead.

readPlusScanWith :: forall (m :: Type -> Type) a. Scanl m (Path, CString, Ptr CStat) a -> (ReadOptions -> ReadOptions) -> Path -> Stream m a Source #

Read with full metadata.

newtype DirStream Source #

Constructors

DirStream (Ptr CDir) 

openDirStreamCString :: CString -> IO DirStream Source #

The CString must be pinned.

closeDirStream :: DirStream -> IO () Source #

closeDirStream dp calls closedir to close the directory stream dp.

readEitherByteChunks :: forall (m :: Type -> Type). MonadIO m => (ReadOptions -> ReadOptions) -> [PosixPath] -> Stream m (Either [PosixPath] (Array Word8)) Source #

This function may not traverse all the directories supplied and it may traverse the directories recursively. Left contains those directories that were not traversed by this function, these my be the directories that were supplied as input as well as newly discovered directories during traversal. To traverse the entire tree we have to iterate this function on the Left output.

Right is a buffer containing directories and files separated by newlines.

eitherReader :: forall (m :: Type -> Type). (MonadIO m, MonadCatch m) => (ReadOptions -> ReadOptions) -> Unfold m Path (Either Path Path) Source #

Read directories as Left and files as Right. Filter out "." and ".." entries.

Internal

reader :: forall (m :: Type -> Type). (MonadIO m, MonadCatch m) => Unfold m Path Path Source #