Popularity
2.9
Growing
Activity
0.0
Stable
3
2
1
Monthly Downloads: 19
Programming language: Haskell
License: MIT License
Latest version: v0.0.5.0
safeio alternatives and similar packages
Based on the "io" category.
Alternatively, view safeio alternatives based on common mentions on social networks and blogs.
-
io-streams-haproxy
HAProxy protocol v1.5 support for io-streams -
io-streams-http
Deprecated, use https://github.com/vertigomedia/http-client-streams
Clean code begins in your IDE with SonarLint
Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.
Promo
www.sonarlint.org
Do you think we are missing an alternative of safeio or a related project?
README
SafeIO: Haskell library for safe (atomic) IO
This is a simple module, which enables writing in atomic mode. It implements the following 4 step procedure:
- Open a temporary file in the same directory as the final output.
- Write to this temporary file.
- Close and sync the file.
- Atomically rename the file to its final destination.
Example
Direct use:
import System.IO.SafeWrite
...
main = do
withOutputFile "output.txt" $ \hout -> do
hPutStrLn hout "Hello World"
Through conduit:
import qualified Data.Conduit as C
import Data.Conduit ((.|))
import Data.Conduit.SafeWrite
main = C.runConduitRes $
C.yield "Hello World" .| safeSinkFile "hello.txt"
In any case, only successful termination of the process will result in the output file being written. Early termination by throwing an exception will cause the temporary file to be removed and no output will be produced.