{"id":13825857,"url":"https://github.com/terkelg/stopgap","last_synced_at":"2025-05-12T15:32:31.213Z","repository":{"id":57371207,"uuid":"219068500","full_name":"terkelg/stopgap","owner":"terkelg","description":"Easily create/remove temporary directories.","archived":false,"fork":false,"pushed_at":"2020-03-15T15:57:06.000Z","size":31,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T20:10:09.958Z","etag":null,"topics":["directory","filesystem","io","os","temporary","tmp"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/terkelg.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":"2019-11-01T21:56:51.000Z","updated_at":"2023-04-03T14:10:04.000Z","dependencies_parsed_at":"2022-09-26T16:41:13.005Z","dependency_job_id":null,"html_url":"https://github.com/terkelg/stopgap","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fstopgap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fstopgap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fstopgap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fstopgap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terkelg","download_url":"https://codeload.github.com/terkelg/stopgap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253766009,"owners_count":21960834,"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":["directory","filesystem","io","os","temporary","tmp"],"created_at":"2024-08-04T09:01:28.132Z","updated_at":"2025-05-12T15:32:30.960Z","avatar_url":"https://github.com/terkelg.png","language":"JavaScript","readme":"# stopgap [![build status](https://badgen.now.sh/github/status/terkelg/stopgap)](https://github.com/terkelg/stopgap/actions) [![codecov](https://badgen.now.sh/codecov/c/github/terkelg/stopgap)](https://codecov.io/gh/terkelg/stopgap)\n\n\u003e Easily create/remove temporary directories\n\nSometimes you just need a quick and easy way to create temporary directories.\nDirectories are created in the standard OS temporary directory.\n\n\nAdditionally, this module is delivered as:\n\n* **ES Module**: [`dist/stopgap.mjs`](https://unpkg.com/stopgap/dist/stopgap.mjs)\n* **CommonJS**: [`dist/stopgap.js`](https://unpkg.com/stopgap/dist/stopgap.js)\n\n\n## Install\n\n```\n$ npm install --save stopgap\n```\n\n\n## Usage\n\n```js\nimport stopgap from 'stopgap';\n\nconst { path, remove } = await stopgap();\n// path ~\u003e /var/folders/c7/fqpgnx7x5654w6z_k3syl11r0000gn/T/sg-LC48Pf\n// remove ~\u003e call function to delete directory\n\n// clean up\nawait remove();\n```\n\n\n## API\n\n### stopgap(opts)\nReturns: `{ path: String, remove: Function }`\n\nCreates a temporary directory in the OS default temp directory, and returns the\nan object with two properties:\n\n#### path\nType: `String`\n\nThe `path` to the created directory.\u003cbr\u003e\nBy default this is created as a hidden folder in the users home directory.\n\n#### remove\nType: `Function`\nReturns: `Promise`\n\nInvoking this function removes and clean out the temporary directory.\u003cbr\u003e\n\u003e **Important:** Everything inside the directory is removed recursively.\n\n\n### opts.prefix\nType: `String`\n\nCustom prefix for folder. Defaults to `sg-`.\n\n\n### opts.dir\nType: `String`\n\nCustom path for the directory. Path is created recursively.\n\nDefaults to the system tmp directory.\n\n\n## License\n\nMIT © [Terkel Gjervig](https://terkel.com)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterkelg%2Fstopgap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterkelg%2Fstopgap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterkelg%2Fstopgap/lists"}