Copyright | (c) 2024 Composewell Technologies |
---|---|
License | BSD3 |
Maintainer | streamly@composewell.com |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Streamly.Internal.FileSystem.Posix.ReadDir
Description
Synopsis
- readScanWith_ :: forall (m :: Type -> Type) a. Scanl m (Path, CString) a -> (ReadOptions -> ReadOptions) -> Path -> Stream m a
- readScanWith :: forall (m :: Type -> Type) a. Scanl m (Path, CString, Ptr CDirent) a -> (ReadOptions -> ReadOptions) -> Path -> Stream m a
- readPlusScanWith :: forall (m :: Type -> Type) a. Scanl m (Path, CString, Ptr CStat) a -> (ReadOptions -> ReadOptions) -> Path -> Stream m a
- newtype DirStream = DirStream (Ptr CDir)
- openDirStream :: PosixPath -> IO DirStream
- openDirStreamCString :: CString -> IO DirStream
- closeDirStream :: DirStream -> IO ()
- readDirStreamEither :: (ReadOptions -> ReadOptions) -> (PosixPath, DirStream) -> IO (Maybe (Either PosixPath PosixPath))
- readEitherChunks :: forall (m :: Type -> Type). MonadIO m => (ReadOptions -> ReadOptions) -> [PosixPath] -> Stream m (Either [PosixPath] [PosixPath])
- readEitherByteChunks :: forall (m :: Type -> Type). MonadIO m => (ReadOptions -> ReadOptions) -> [PosixPath] -> Stream m (Either [PosixPath] (Array Word8))
- readEitherByteChunksAt :: forall (m :: Type -> Type). MonadIO m => (ReadOptions -> ReadOptions) -> (PosixPath, [PosixPath]) -> Stream m (Either (PosixPath, [PosixPath]) (Array Word8))
- eitherReader :: forall (m :: Type -> Type). (MonadIO m, MonadCatch m) => (ReadOptions -> ReadOptions) -> Unfold m Path (Either Path Path)
- reader :: forall (m :: Type -> Type). (MonadIO m, MonadCatch m) => Unfold m Path Path
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.
closeDirStream :: DirStream -> IO () Source #
closeDirStream dp
calls closedir
to close
the directory stream dp
.
readDirStreamEither :: (ReadOptions -> ReadOptions) -> (PosixPath, DirStream) -> IO (Maybe (Either PosixPath PosixPath)) Source #
readEitherChunks :: forall (m :: Type -> Type). MonadIO m => (ReadOptions -> ReadOptions) -> [PosixPath] -> Stream m (Either [PosixPath] [PosixPath]) Source #
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.
readEitherByteChunksAt :: forall (m :: Type -> Type). MonadIO m => (ReadOptions -> ReadOptions) -> (PosixPath, [PosixPath]) -> Stream m (Either (PosixPath, [PosixPath]) (Array Word8)) Source #
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