directory-ospath-streaming-0.2.2: Stream directory entries in constant memory in vanilla IO

Copyright | (c) Sergey Vinokurov 2024
License | Apache-2.0 (see LICENSE)
Maintainer | serg.foo@gmail.com
Safe Haskell | None
Language | Haskell2010

System.Directory.OsPath.Streaming.Internal

Description

Synopsis

- data DirStream = DirStream {
  - dsHandle :: !RawDirStream
  - dsIsClosed :: !Counter
  - dsFin :: !(Weak DirStream)
  }
- openDirStream :: OsPath -> IO DirStream
- readDirStream :: DirStream -> IO (Maybe (OsPath, FileType))
- closeDirStream :: DirStream -> IO ()
- readDirStreamWithCache :: DirReadCache -> DirStream -> IO (Maybe (OsPath, Basename OsPath, FileType))

# Documentation

data DirStream Source #

Abstract handle to directory contents.

May be closed multiple times and will be automatically closed by GC when it goes out of scope.

Constructors

DirStream |

Fields

- dsHandle :: !RawDirStream
- dsIsClosed :: !Counter
- dsFin :: !(Weak DirStream)

openDirStream :: OsPath -> IO DirStream Source #

readDirStream :: DirStream -> IO (Maybe (OsPath, FileType)) Source #

closeDirStream :: DirStream -> IO () Source #

Deallocate directory handle. It’s safe to close `DirStream` multiple times, unlike the underlying OS-specific directory stream handle.

readDirStreamWithCache :: DirReadCache -> DirStream -> IO (Maybe (OsPath, Basename OsPath, FileType)) Source #