{"id":18158282,"url":"https://github.com/sam0x17/tempdir","last_synced_at":"2025-05-07T03:08:22.993Z","repository":{"id":82773177,"uuid":"135159228","full_name":"sam0x17/tempdir","owner":"sam0x17","description":"Simple creation and automatic deletion of temporary directories in an easy to use crystal shard","archived":false,"fork":false,"pushed_at":"2019-06-11T10:24:32.000Z","size":9,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T14:21:16.783Z","etag":null,"topics":["crystal-language","libraries","shards","temporary","temporary-directory"],"latest_commit_sha":null,"homepage":null,"language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sam0x17.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-05-28T12:39:31.000Z","updated_at":"2020-05-22T18:56:32.000Z","dependencies_parsed_at":"2023-11-10T11:56:11.997Z","dependency_job_id":null,"html_url":"https://github.com/sam0x17/tempdir","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam0x17%2Ftempdir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam0x17%2Ftempdir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam0x17%2Ftempdir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam0x17%2Ftempdir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sam0x17","download_url":"https://codeload.github.com/sam0x17/tempdir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246423494,"owners_count":20774796,"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":["crystal-language","libraries","shards","temporary","temporary-directory"],"created_at":"2024-11-02T07:06:10.767Z","updated_at":"2025-03-31T23:32:02.835Z","avatar_url":"https://github.com/sam0x17.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tempdir\n\nA simple crystal language shard providing on-the-fly unique temporary directories\nthat are automatically deleted via an `at_exit` hook.\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  tempdir:\n    github: sam0x17/tempdir\n```\n\n## Usage\n\nSimply call the constructor on the `TempDir` class and a temporary directory will be created.\nYou can pass a string argument to the constructor and this will be used as a prefix to the\ndirectory that gets created. The suffix is populated with a 16-diit random number. When\nthe current crystal program exits, any directories created by TempDir will be deleted\nautomatically.\n\n```crystal\nrequire \"tempdir\"\n\ndir = TempDir.new \"my-prefix\"\nputs dir.to_s # prints \"/tmp/my-prefix-7135891628311294\"\n```\n\nAlso available is a block-based invocation style, which will create a temporary directory\nthat will exist for the lifetime of the block that is passed (when the block ends, the\ndirectory is deleted).\n\n```crystal\nrequire \"tempdir\"\n\nTempDir.create do |path|\n  # do stuff with path\nend\n```\n\nAs with the class-based invocation style, you can also pass a prefix:\n\n```crystal\nrequire \"tempdir\"\n\nTempDir.create(\"my-prefix\") do |path|\n  # do stuff with path\nend\n```\n\n## Contributing\n\n1. Fork it ( https://github.com/[your-github-name]/tempdir/fork )\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Contributors\n\n- [sam0x17](https://github.com/sam0x17) Sam Johnson - creator, maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam0x17%2Ftempdir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsam0x17%2Ftempdir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam0x17%2Ftempdir/lists"}