| 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))
- readDirStreamFull :: DirStream -> IO (Maybe (OsPath, Basename OsPath, FileType))
- closeDirStream :: DirStream -> IO ()
Documentation
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
| |
readDirStream :: DirStream -> IO (Maybe (OsPath, FileType)) Source #
Returns basename path of the directory entry.
readDirStreamFull :: DirStream -> IO (Maybe (OsPath, Basename OsPath, FileType)) Source #
Returns both basename path and full path of a directory entry relative to the
passed DirStream root.
For example:
readDirStreamFull =<< openDirStream [osp|.|]
Just ("./bar",Basename {unBasename = "foo"},File Regular)readDirStreamFull =<< openDirStream [osp|foo/|]
Just ("foo/bar",Basename {unBasename = "foo"},File Regular)readDirStreamFull =<< openDirStream [osp|/foo/foo|]
Just ("/foo/foo/bar",Basename {unBasename = "foo"},File Regular)This allows to avoid re-creating the full path on the client side and thus reduce allocations.