tmpdir
Version, currently master branch1 version
- master branchlatestNov 1, 2016
github.com/marceloboeira/tmpdir.cr
🐵 Monkey Patch for tmp dir creation on Crystal standard library
Installation
# Add this to your shard.yml
dependencies:
tmpdir:
github: marceloboeira/tmpdir.cr
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- Marcelo Boeira
Dependencies
This version declares no dependencies.
README
tmpdir.cr
Temporary Monkey Patch solution to create temporary directories with Crystal
Installation
Add this to your application's shard.yml:
dependencies:
tmpdir:
github: marceloboeira/tmpdir.cr
Usage
Require the library
Then:
Without prefix:
require "tmpdir"
puts Dir.mktmpdir
# => /tmp/c.a39bF4
With prefix:
require "tmpdir"
puts Dir.mktmpdir("foo")
# => /tmp/foo.a39bF4
Within a block:
require "tmpdir"
Dir.mktmpdir("foo") do |tmp_dir|
puts tmp_dir
# => /tmp/foo.a39bF4
end
# tmp_dir does not exists anymore
The solution uses the LibC.mkdtemp bind.
The mkdtemp function creates a directory with a unique name. If it
succeeds, it overwrites template with the name of the directory, and
returns template. As with mktemp and mkstemp, template should be a
string ending with ‘XXXXXX’.
Reference:
- http://www.gnu.org/software/libc/manual/html_node/Temporary-Files.html
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Nov 1, 2016
- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/marceloboeira/tmpdir.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 1