withFile package:streamly-core

withFile name mode act opens a file using openFile and passes the resulting handle to the computation act. The handle will be closed on exit from withFile, whether by normal termination or by raising an exception. If closing the handle raises an exception, then this exception will be raised by withFile rather than any exception raised by act. Pre-release
withFile name mode act opens a file and passes the resulting handle to the computation act. The handle is closed on exit from withFile, whether by normal termination or by raising an exception. If closing the handle raises an exception, then that exception is raised by withFile rather than any exception raised by act. The file is opened in binary mode as encoding, decoding, and newline translation can be handled explicitly by the streaming APIs. The file is opened without buffering as buffering can be controlled explicitly by the streaming APIs. Pre-release
Like withFile in base package but using Path instead of FilePath. Use hSetBinaryMode on the handle if you want to use binary mode.