Pipes Filesystem
An experimental library that provides basic functions for efficient streaming over directory trees, compatible with the Haskell Pipes ecosystem.
Please note that this library is still experimental and in development. Using it may delete all the files on your hard disk or even burn down your house (although it probably won't).
Functionality
Use Pipes.FileSystem.children
to iterate (non-recursively) over all children of given directory.
Use Pipes.FileSystem.descendants
to iterate (recursively) over all descendants of a given directory.
Traversal order can be specified using Pipes.FileSystem.TraversalOrder
.
Performance
In order to stream the contents of directory trees as efficiently as possible, this library uses the Linux readdir
function which provides extended type information about each directory entry. (This is in contrast to the POSIX-compliant version of readdir
, which only provides the name of each directory entry, and no type information.) This type information is made available to downstream consumers through the FileInfo
type, thus making it possible for consumers to avoid the expense of calling stat
in many situations.
Compatibility
Currently this library only supports Linux. Support for other operating systems such as Windows or other UNIX-like operating systems could be added if enough people want it. Feel free to contribute a patch!
Building
stack build
Notes
This package depends upon a patched version of the Haskell Unix package, which provides Linux-specific file system functions.
This may change in future.