tempdir
Version, currently 1.0.05 versions
- 1.0.4latestJun 11, 2019
- 1.0.3not indexedJun 11, 2019
- 1.0.2not indexedJun 11, 2019
- 1.0.1not indexedJun 11, 2019
- 1.0.0not indexedJun 11, 2019
github.com/sam0x17/tempdir
Simple creation and automatic deletion of temporary directories in an easy to use crystal shard
Nothing has been indexed for 1.0.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
tempdir:
github: sam0x17/tempdir
version: ~> 1.0.0Then run:
shards installshard.yml
No shard.yml has been indexed for 1.0.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
tempdir
A simple crystal language shard providing on-the-fly unique temporary directories
that are automatically deleted via an at_exit hook.
Installation
Add this to your application's shard.yml:
dependencies:
tempdir:
github: sam0x17/tempdir
Usage
Simply call the constructor on the TempDir class and a temporary directory will be created.
You can pass a string argument to the constructor and this will be used as a prefix to the
directory that gets created. The suffix is populated with a 16-diit random number. When
the current crystal program exits, any directories created by TempDir will be deleted
automatically.
require "tempdir"
dir = TempDir.new "my-prefix"
puts dir.to_s # prints "/tmp/my-prefix-7135891628311294"
Also available is a block-based invocation style, which will create a temporary directory that will exist for the lifetime of the block that is passed (when the block ends, the directory is deleted).
require "tempdir"
TempDir.create do |path|
# do stuff with path
end
As with the class-based invocation style, you can also pass a prefix:
require "tempdir"
TempDir.create("my-prefix") do |path|
# do stuff with path
end
Contributing
- Fork it ( https://github.com/[your-github-name]/tempdir/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- sam0x17 Sam Johnson - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.0.0- Tagged
- Jun 11, 2019
- Commit
6119ab01c8f6- Indexed
- not yet
Dependents
Repository
github.com/sam0x17/tempdir
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 5