Popularity
4.3
Declining
Activity
0.0
Stable
11
3
4

Programming language: Crystal
License: ISC License
Tags: Misc    
Latest version: v0.1.5

atomic_write.cr alternatives and similar shards

Based on the "Misc" category.
Alternatively, view atomic_write.cr alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of atomic_write.cr or a related project?

Add another 'Misc' Shard

README

atomic_write.cr

Docs GitHub release Build Status

Extends File to provide atomic_write().

An atomic write creates a new file at a temporary path. It then writes the new file contents to that file. Lastly it renames it to the original path. This dramatically reduces the opportunity for file corruption.

Installation

Add this to your application's shard.yml:

dependencies:
  atomic_write:
    github: chris-huxtable/atomic_write.cr

Usage

require "atomic_write"

Atomic write:

File.atomic_write("some/path") { |fd| fd << "hello world" }

Atomic append:

File.atomic_write("some/path", append: true) { |fd| fd << "hello world" }

Atomic copy:

File.atomic_copy("some/src/path", "some/dst/path")

Atomic replace:

File.atomic_replace("some/src/path") { |src_fd, dst_fd| dst_fd << "hello" << src_fd.gets_to_end }

Contributing

  1. Fork it ( https://github.com/chris-huxtable/atomic_write.cr/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors