{"id":15063877,"url":"https://github.com/luispedro/safeio","last_synced_at":"2025-07-29T17:06:14.260Z","repository":{"id":56877045,"uuid":"92746881","full_name":"luispedro/safeio","owner":"luispedro","description":"Haskell Library for safe (atomic) IO","archived":false,"fork":false,"pushed_at":"2023-06-26T15:04:14.000Z","size":23,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-25T23:31:19.074Z","etag":null,"topics":["haskell","io"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luispedro.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-29T14:20:48.000Z","updated_at":"2023-06-26T14:25:53.000Z","dependencies_parsed_at":"2024-09-25T00:08:36.320Z","dependency_job_id":"3e8894a7-1793-4f4e-b328-dbe97fccc6a4","html_url":"https://github.com/luispedro/safeio","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"ac41becdd82f0eeb3341cc0e30d3b95a4a59e4e8"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispedro%2Fsafeio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispedro%2Fsafeio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispedro%2Fsafeio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luispedro%2Fsafeio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luispedro","download_url":"https://codeload.github.com/luispedro/safeio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208649,"owners_count":21065203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","io"],"created_at":"2024-09-25T00:08:24.193Z","updated_at":"2025-04-10T11:26:45.345Z","avatar_url":"https://github.com/luispedro.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SafeIO: Haskell library for safe (atomic) IO\n\n[![Hackage](https://img.shields.io/hackage/v/safeio.svg)](https://hackage.haskell.org/package/safeio)\n[![Hackage-Deps](https://img.shields.io/hackage-deps/v/safeio.svg)](http://packdeps.haskellers.com/feed?needle=safeio)\n[![Stackage (LTS)](http://stackage.org/package/safeio/badge/lts)](http://stackage.org/lts/package/safeio)\n[![Travis](https://api.travis-ci.com/luispedro/safeio.png)](https://travis-ci.com/luispedro/safeio)\nAtomic IO\n\nThis is a simple module, which enables writing in atomic mode. It\nimplements the following 4 step procedure:\n\n1. Open a temporary file in the same directory as the final output.\n2. Write to this temporary file.\n3. Close and sync the file.\n4. Atomically rename the file to its final destination.\n\n\n## Example\n\nDirect use:\n\n    import System.IO.SafeWrite\n    ...\n    main = do\n        withOutputFile \"output.txt\" $ \\hout -\u003e do\n            hPutStrLn hout \"Hello World\"\n\nThrough [conduit](https://www.stackage.org/package/conduit):\n\n    import qualified Data.Conduit as C\n    import           Data.Conduit ((.|))\n    import           Data.Conduit.SafeWrite\n    \n    main = C.runConduitRes $\n        C.yield \"Hello World\" .| safeSinkFile \"hello.txt\"\n\nIn any case, only successful termination of the process will result in the\noutput file being written. Early termination by throwing an exception will\ncause the temporary file to be removed and no output will be produced.\n\n## Author\n\nLuis Pedro Coelho | [Email](mailto:luis@luispedro.org) | [Twitter](https://twitter.com/luispedrocoelho)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluispedro%2Fsafeio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluispedro%2Fsafeio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluispedro%2Fsafeio/lists"}