{"id":15562114,"url":"https://github.com/mrkamel/tempfile_for","last_synced_at":"2026-03-07T06:31:51.109Z","repository":{"id":4752946,"uuid":"5902865","full_name":"mrkamel/tempfile_for","owner":"mrkamel","description":"Create temporary files for in-memory data","archived":false,"fork":false,"pushed_at":"2014-05-29T14:44:29.000Z","size":220,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-05T12:48:59.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/mrkamel.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}},"created_at":"2012-09-21T14:54:31.000Z","updated_at":"2019-08-13T15:09:24.000Z","dependencies_parsed_at":"2022-09-21T00:41:07.656Z","dependency_job_id":null,"html_url":"https://github.com/mrkamel/tempfile_for","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrkamel/tempfile_for","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Ftempfile_for","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Ftempfile_for/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Ftempfile_for/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Ftempfile_for/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrkamel","download_url":"https://codeload.github.com/mrkamel/tempfile_for/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkamel%2Ftempfile_for/sbom","scorecard":{"id":664200,"data":{"date":"2025-08-11","repo":{"name":"github.com/mrkamel/tempfile_for","commit":"93c9634b1a236c54706eda8626acd98b60f81b15"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T17:22:25.642Z","repository_id":4752946,"created_at":"2025-08-21T17:22:25.642Z","updated_at":"2025-08-21T17:22:25.642Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-02T16:11:46.109Z","updated_at":"2026-03-07T06:31:51.092Z","avatar_url":"https://github.com/mrkamel.png","language":"Ruby","readme":"\n[![Build Status](https://secure.travis-ci.org/mrkamel/tempfile_for.png?branch=master)](http://travis-ci.org/mrkamel/tempfile_for)\n[![Code Climate](https://codeclimate.com/github/mrkamel/tempfile_for.png)](https://codeclimate.com/github/mrkamel/tempfile_for)\n[![Dependency Status](https://gemnasium.com/mrkamel/tempfile_for.png?travis)](https://gemnasium.com/mrkamel/tempfile_for)\n\n# TempfileFor\n\nEasily create temporary files for in-memory data, modify the file, and get the\nfull content returned.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```\ngem \"tempfile_for\"\n```\n\nAnd then execute:\n\n```\n$ bundle\n```\n\nAlternatively, you can of course install it without using bundler via:\n\n```\n$ gem install tempfile_for\n```\n\n## Usage\n\n### for\n\nTempfileFor is a very tiny gem, but it can save you lines of ugly code.\n\nTo get a quick introduction into what TempfileFor does, check this out:\n\n```ruby\nTempfile.for(\"string1\") { |tempfile| `echo -n ', string2' \u003e\u003e #{tempfile.path}` }\n# =\u003e \"string1, string2\"\n```\n\nSay, you have some in-memory data, like an image you fetch from an URL - and\nyou want to somehow modify it partially like e.g., add or remove IPTC tags, or\nscale it, etc. Often, the gems used to modify images or other media files\nrequire a path to the file to be able to modify it.\n\nThis is easy thanks to TempfileFor:\n\n```ruby\ndata = RestClient.get(\"http://example.com/image.jpg\")\n\nimage = Tempfile.for(data) do |tempfile|\n  # Modify the tempfile directly or using tempfile.path and get the modified content returned.\n  # Tempfile takes care about flushing the file's modifications and rewinding, etc.\nend\n```\n\n### blank\n\nIf you want to use TempfileFor without initial data, simply use:\n\n```ruby\nTempfile.blank { |tempfile| `echo -n data \u003e\u003e #{tempfile.path}` }\n```\n\n### Tempfile object\n\nIn case you need the tempfile object itself, because you e.g. don't want to\nload it into memory, add `:read =\u003e false` to either `Tempfile#for` or\n`Tempfile#blank`\n\n```ruby\nTempfile.for(\"string\", :read =\u003e false) { |tempfile| ... } # =\u003e #\u003cFile:/tmp/tempfile...\u003e\nTempfile.blank(:read =\u003e false) { |tempfile| ... } # =\u003e #\u003cFile:/tmp/tempfile...\u003e\n```\n\n## Encoding\n\nTempfileFor preserves the encoding of the supplied data. Thus, the following\ncode\n\n```ruby\nTempfile.for(\"string1\".encode(Encoding::ISO_8859_1)) { ... }\n```\n\nwill return a string encoded as ISO-8859-1. If you use the blank method, you\ncan supply the desired encoding via\n\n```ruby\nTempfile.blank(:encoding =\u003e Encoding::BINARY) { ... }\n```\n\nwill return a string encoded as binary.\n\n## Suffix\n\nYou can pass a `:suffix =\u003e \"...\"` option to all methods, such that\n\n```ruby\nTempfile.for(\"data\", :suffix =\u003e \".jpg\")\nTempfile.blank(:suffix =\u003e \".jpg\") { ... }\n```\n\nwill create tempfiles having a `.jpg` suffix.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkamel%2Ftempfile_for","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrkamel%2Ftempfile_for","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkamel%2Ftempfile_for/lists"}