{"id":13725694,"url":"https://github.com/lukeed/premove","last_synced_at":"2025-10-09T18:24:02.478Z","repository":{"id":57329852,"uuid":"190940529","full_name":"lukeed/premove","owner":"lukeed","description":"A tiny (201B to 247B) utility to remove items recursively","archived":false,"fork":false,"pushed_at":"2023-12-30T07:53:46.000Z","size":28,"stargazers_count":81,"open_issues_count":3,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-19T01:51:20.931Z","etag":null,"topics":[],"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/lukeed.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}},"created_at":"2019-06-08T22:19:55.000Z","updated_at":"2025-09-17T12:35:04.000Z","dependencies_parsed_at":"2024-01-06T01:55:00.421Z","dependency_job_id":"784b57d9-3ee4-4fb0-8572-af7b65190afe","html_url":"https://github.com/lukeed/premove","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"8a2600afc4d6f8fe81877bd7e87f182f99b70706"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/lukeed/premove","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpremove","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpremove/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpremove/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpremove/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/premove/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpremove/sbom","scorecard":{"id":604512,"data":{"date":"2025-08-11","repo":{"name":"github.com/lukeed/premove","commit":"8a2600afc4d6f8fe81877bd7e87f182f99b70706"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeed/premove/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeed/premove/ci.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:24","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:25","Warn: downloadThenRun not pinned by hash: .github/workflows/ci.yml:34","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"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":"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"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":"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":"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-21T01:16:11.930Z","repository_id":57329852,"created_at":"2025-08-21T01:16:11.931Z","updated_at":"2025-08-21T01:16:11.931Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001940,"owners_count":26083226,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-08-03T01:02:31.573Z","updated_at":"2025-10-09T18:24:02.461Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","funding_links":[],"categories":["Utilities","JavaScript","Packages"],"sub_categories":["Project Tools","Others"],"readme":"# premove [![CI](https://github.com/lukeed/premove/workflows/CI/badge.svg)](https://github.com/lukeed/premove/actions) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/premove)](https://codecov.io/gh/lukeed/premove)\n\n\u003e A tiny (208B to 260B) utility to remove items recursively\n\nThis is a `Promise`-based, cross-platform utility that recursively removes files and directories. It's effectively a programmatic `rm -rf` for Node.js. There's also a [CLI](#cli) for easy, cross-platform usage.\n\n\u003e **Notice:** Node v12.10.0 includes the `recursive` option for [`fs.rmdir`](https://nodejs.org/api/fs.html#fs_fs_rmdir_path_options_callback) and [`fs.rmdirSync`](https://nodejs.org/api/fs.html#fs_fs_rmdirsync_path_options).\n\n## Install\n\n```\n$ npm install --save premove\n```\n\n\n## Modes\n\nThere are two \"versions\" of `premove` available:\n\n#### \"async\"\n\u003e **Node.js:** \u003e= 8.x\u003cbr\u003e\n\u003e **Size (gzip):** 249 bytes\u003cbr\u003e\n\u003e **Availability:** [CommonJS](https://unpkg.com/premove/dist/index.js), [ES Module](https://unpkg.com/premove/dist/index.mjs)\n\nThis is the primary/default mode. It makes use of `async`/`await` and [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original).\n\n#### \"sync\"\n\u003e **Node.js:** \u003e= 6.x\u003cbr\u003e\n\u003e **Size (gzip):** 202 bytes\u003cbr\u003e\n\u003e **Availability:** [CommonJS](https://unpkg.com/premove/sync/index.js), [ES Module](https://unpkg.com/premove/sync/index.mjs)\n\nThis is the opt-in mode, ideal for scenarios where `async` usage cannot be supported.\u003cbr\u003eIn order to use it, simply make the following changes:\n\n```diff\n-import { premove } from 'premove';\n+import { premove } from 'premove/sync';\n```\n\n## Usage\n\n```js\nimport { resolve } from 'path';\nimport { premove } from 'premove';\n\n// Async/await\ntry {\n  await premove('./foobar');\n} catch (err) {\n  //\n}\n\n// Promise\npremove('./foobar').then(val =\u003e {\n  console.log(typeof val);\n  //=\u003e boolean\n}).catch(err =\u003e {\n  //\n});\n\n// Using `cwd` option\nconst dir = resolve('./foo/bar');\nawait premove('hello.txt', { cwd: dir });\n```\n\n## CLI\n\nA `premove` binary is available as of v3.0.0. \u003cbr\u003eIt accepts an optional `--cwd` value and a list of paths to delete.\n\n\u003e **Important:** By default `premove` refuses to delete:\n\u003e * the [`os.homedir`](https://nodejs.org/api/os.html#os_os_homedir)\n\u003e * the system root (`/`, `C:\\\\`, etc)\n\u003e * items not contained by `--cwd` path\n\n```sh\n# remove \"foo\" and \"bar\" via `npx`\n$ npx premove foo bar\n\n# install globally, use whenever\n$ npm install premove -g\n$ premove foo bar\n```\n\n## API\n\n### premove(str, opts={})\nReturns: `Promise\u003cboolean\u003e`\n\nReturns a Promise that resolves with a boolean value. \u003cbr\u003eIf `true`, indicates that the `str` input _did exist_ and was successfully removed. A `false` value indicates that the `str` input _did not exist_, meaning nothing needed to be removed.\n\n\u003e **Important:**\u003cbr\u003eThe `sync` and `async` versions share the same API.\u003cbr\u003eThe **only** difference is that `sync` is not Promise-based.\n\n#### str\nType: `String`\n\nThe filepath to remove – may be a file or a directory.\u003cbr\u003e\nAn initial existence check is made for this filepath.\n\n\u003e **Important:** This [value is resolved](https://nodejs.org/api/path.html#path_path_resolve_paths) to a full path.\u003cbr\u003e\nPlease be aware of how and _from where_ the Node.js file system is resolving your path!\n\n#### options.cwd\nType: `String`\u003cbr\u003e\nDefault: `.`\n\nThe directory to resolve your `str` from.\u003cbr\u003e\nDefaults to the `process.cwd()` – aka, the directory that your command is run within.\n\n\n## Related\n\n- [totalist](https://github.com/lukeed/totalist) - A tiny (195B to 224B) utility to recursively list all (total) files in a directory\n- [mk-dirs](https://github.com/lukeed/mk-dirs) - A tiny (381B to 419B) utility to make a directory and its parents, recursively\n- [escalade](https://github.com/lukeed/escalade) - A tiny (183B) and fast utility to ascend parent directories\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fpremove","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Fpremove","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fpremove/lists"}