{"id":15679500,"url":"https://github.com/leonklingele/securetemp","last_synced_at":"2025-05-07T10:02:50.656Z","repository":{"id":57480375,"uuid":"99904372","full_name":"leonklingele/securetemp","owner":"leonklingele","description":"Secure temporary directories and files in Go (ram disk, tmpfs)","archived":false,"fork":false,"pushed_at":"2021-01-18T09:31:20.000Z","size":1075,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T02:23:46.183Z","etag":null,"topics":["ramdisk","security","temporary-directories","temporary-files","tmpfile","tmpfs"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonklingele.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":"2017-08-10T09:12:47.000Z","updated_at":"2024-05-13T23:29:41.000Z","dependencies_parsed_at":"2022-09-26T17:41:41.059Z","dependency_job_id":null,"html_url":"https://github.com/leonklingele/securetemp","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonklingele%2Fsecuretemp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonklingele%2Fsecuretemp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonklingele%2Fsecuretemp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonklingele%2Fsecuretemp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonklingele","download_url":"https://codeload.github.com/leonklingele/securetemp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252856549,"owners_count":21814858,"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":["ramdisk","security","temporary-directories","temporary-files","tmpfile","tmpfs"],"created_at":"2024-10-03T16:32:05.829Z","updated_at":"2025-05-07T10:02:50.596Z","avatar_url":"https://github.com/leonklingele.png","language":"Go","readme":"# Secure temporary directories and files in Go\n\n[![Build Status](https://travis-ci.org/leonklingele/securetemp.svg?branch=master)](https://travis-ci.org/leonklingele/securetemp)\n\nThis CLI app and library can be used to create temporary directories and files inside RAM.\nThis is useful if you temporarily need a file to store sensitive data in.\n\n## tl;dr\n\n```sh\n# Install library\ngo get -u github.com/leonklingele/securetemp\n\n# Install library + CLI app (\"securetemp\")\ngo get -u github.com/leonklingele/securetemp/...\nsecuretemp -h\n```\n\n```go\n// Create a temporary file inside a RAM disk which is securetemp.DefaultSize big\ntmpFile, cleanupFunc, err := securetemp.TempFile(securetemp.DefaultSize)\nif err != nil {\n\t// TODO: Properly handle error\n\tlog.Fatal(err)\n}\n// `tmpFile` is an *os.File\nif _, err := tmpFile.WriteString(\"Hello, World!\"); err != nil {\n\t// TODO: Properly handle error\n\tlog.Fatal(err)\n}\n// Call the cleanup func as soon as you no longer need the file.\n// The file is deleted and the RAM is freed again.\n// The cleanup function also calls `tmpFile.Close()` for you.\ncleanupFunc()\n```\n\n```go\n// Create a temporary directory inside a RAM disk which is 20MB big\ntmpDir, cleanupFunc, err := securetemp.TempDir(20 * securetemp.SizeMB)\nif err != nil {\n\t// TODO: Properly handle error\n\tlog.Fatal(err)\n}\n// Create one / multiple file/s inside `tmpDir`\nfile, err := os.Create(path.Join(tmpDir, \"myfile.txt\"))\nif err != nil {\n\t// TODO: Properly handle error\n\tlog.Fatal(err)\n}\ndefer file.Close()\n// Do something with `file`\nif _, err := file.WriteString(\"Hello, World!\"); err != nil {\n\t// TODO: Properly handle error\n\tlog.Fatal(err)\n}\nfile.Close()\n// Call the cleanup func as soon as you no longer need the directory.\n// The directory is deleted and the RAM is freed again.\n// Make sure to close every file inside `tmpDir` before.\ncleanupFunc()\n```\n\n## Idea\n\nThis project was inspired by [pass](https://www.passwordstore.org/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonklingele%2Fsecuretemp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonklingele%2Fsecuretemp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonklingele%2Fsecuretemp/lists"}