{"id":13725167,"url":"https://github.com/lukeed/scorta","last_synced_at":"2025-10-09T18:24:21.057Z","repository":{"id":66007896,"uuid":"298357264","full_name":"lukeed/scorta","owner":"lukeed","description":"A tiny (330B to 357B) and fast utility to find a package's hidden supply / cache directory.","archived":false,"fork":false,"pushed_at":"2020-10-05T18:55:35.000Z","size":19,"stargazers_count":33,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-08T19:22:59.091Z","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":".github/FUNDING.yml","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},"funding":{"github":"lukeed"}},"created_at":"2020-09-24T18:06:03.000Z","updated_at":"2025-08-27T13:22:03.000Z","dependencies_parsed_at":"2023-03-16T11:00:33.891Z","dependency_job_id":null,"html_url":"https://github.com/lukeed/scorta","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"de45b44dbb548315e6b841f14c652f31beffc082"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lukeed/scorta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fscorta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fscorta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fscorta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fscorta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/scorta/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fscorta/sbom","scorecard":{"id":604535,"data":{"date":"2025-08-11","repo":{"name":"github.com/lukeed/scorta","commit":"de45b44dbb548315e6b841f14c652f31beffc082"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/17 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":"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":"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":"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/scorta/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/lukeed/scorta/ci.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:21","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:22","Warn: downloadThenRun not pinned by hash: .github/workflows/ci.yml:31","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":"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":"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":"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":"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"}},{"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"}}]},"last_synced_at":"2025-08-21T01:16:27.045Z","repository_id":66007896,"created_at":"2025-08-21T01:16:27.045Z","updated_at":"2025-08-21T01:16:27.045Z"},"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:14.841Z","updated_at":"2025-10-09T18:24:21.029Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","funding_links":["https://github.com/sponsors/lukeed"],"categories":["JavaScript"],"sub_categories":[],"readme":"# scorta [![CI](https://github.com/lukeed/scorta/workflows/CI/badge.svg)](https://github.com/lukeed/scorta/actions) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/scorta)](https://codecov.io/gh/lukeed/scorta)\n\n\u003e A tiny (330B to 357B) and [fast](#benchmarks) utility to find a module's hidden supply / cache directory.\n\nWith `scorta`, you can locate a module's private `.cache` directory by name.\nThis is a common practice among many popular libraries, including AVA, `nyc`, Babel, etc.\n\n```sh\n# Others\n./node_modules/.cache/ava\n./node_modules/.cache/babel\n./node_modules/.cache/nyc\n# Yours!\n./node_modules/.cache/hello-world\n```\n\nWhen searching, the following steps are taken:\n\n1) Echo the value of `process.env.CACHE_DIR` if defined and truthy\n2) [Traverse parent directories](https://github.com/lukeed/escalade) until a `package.json` file is found\n3) If a `package.json` was found, return a `node_modules/.cache/{name}` path _only_ if it's not read-only\n4) All other cases return a `fallback`, which is either `undefined` or a [`os.tmpdir`](https://nodejs.org/api/os.html#os_os_tmpdir) value\n\n\u003e **Why \"scorta\"?** It's Italian for a stock or a supply, which is generally the purpose for a `.cache` directory.\n\n\n## Install\n\n```\n$ npm install --save scorta\n```\n\n\n## Modes\n\nThere are two \"versions\" of `scorta` available:\n\n#### \"async\"\n\u003e **Node.js:** \u003e= 8.x\u003cbr\u003e\n\u003e **Size (gzip):** 357 bytes\u003cbr\u003e\n\u003e **Availability:** [CommonJS](https://unpkg.com/scorta/dist/index.js), [ES Module](https://unpkg.com/scorta/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):** 330 bytes\u003cbr\u003e\n\u003e **Availability:** [CommonJS](https://unpkg.com/scorta/sync/index.js), [ES Module](https://unpkg.com/scorta/sync/index.mjs)\n\nThis is the opt-in mode, ideal for scenarios where `async` usage cannot be supported.\n\n\n## Usage\n\n***Example Structure***\n\n```\n/example\n  ├── fixtures\n    └── empty.js\n  └── demo\n    └── node_modules/...\n    └── package.json\n    └── index.js\n```\n\n***Example Usage***\n\n```js\n// demo/index.js\n\nimport { join } from 'path';\nimport { scorta } from 'scorta';\n\nconst fixtures = join(__dirname, '..', 'fixtures');\n\nawait scorta('hello');\n//=\u003e \"/example/demo/node_modules/.cache/hello\"\n\nawait scorta('hello', { cwd: fixtures });\n//=\u003e undefined\n\nawait scorta('hello', { cwd: fixtures, tmpdir: true });\n//=\u003e \"/var/folders/77/hdmgkj_x2l7454w0y5lwv2l80000gn/T\"\n```\n\n\u003e **Note:** To run the above example with \"sync\" mode, import from `scorta/sync` \u0026 remove the `await`s.\n\n\n## API\n\n### scorta(name, options)\nReturns: `Promise\u003cstring|void\u003e` or `string|void`\n\nWhen `scorta` locates a valid directory, the value will always be an absolute path (`string`).\n\nHowever, if `scorta` cannot locate a valid, writable directory, then the return value is `undefined` by default. However, this can be changed via the [`tmpdir`](#optionstmpdir) option.\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#### name\nType: `string`\n\nThe target module's name.\n\nThis value is used to construct the final `.cache` directory path. For example:\n\n```js\nawait scorta('hello');\n//=\u003e /.../node_modules/.cache/hello\n```\n\n#### options.cwd\nType: `string`\u003cbr\u003e\nDefault: `.`\n\nThe directory where path resolution should begin.\nDefauls to the `process.cwd()` – aka, the directory that your `process` is run within.\n\n\n#### options.tmpdir\nType: `boolean`\u003cbr\u003e\nDefault: `false`\n\nWhen truthy, `scorta` will return a [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) value instead of `undefined`.\n\n\u003e **Important:** When this option is in use, `scorta` always yields a string!\n\n\n## Benchmarks\n\n\u003e Running on Node.js v10.13.0\n\n```\n# Load Time\n  find-cache-dir  11.628ms\n  scorta           1.326ms\n  scorta/sync      0.508ms\n\n# Levels: 0 (target = \"foo\"):\n  find-cache-dir   x 10,700 ops/sec ±0.55% (82 runs sampled)\n  scorta/sync      x 11,060 ops/sec ±0.83% (88 runs sampled)\n  scorta           x 80,804 ops/sec ±2.22% (74 runs sampled)\n\n# Levels: 6 (target = \"bar\"):\n  find-cache-dir   x  2,107 ops/sec ±0.42% (89 runs sampled)\n  scorta/sync      x  5,507 ops/sec ±0.46% (91 runs sampled)\n  scorta           x 78,593 ops/sec ±4.03% (79 runs sampled)\n\n# Levels: 11 (target = \"baz\"):\n  find-cache-dir   x  1,377 ops/sec ±0.36% (93 runs sampled)\n  scorta/sync      x  3,892 ops/sec ±0.25% (95 runs sampled)\n  scorta           x 76,641 ops/sec ±6.92% (68 runs sampled)\n```\n\n\n## Related\n\n- [escalade](https://github.com/lukeed/escalade) - A tiny (183B to 210B) utility to ascend parent directories\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 (380B to 420B) utility to make a directory and its parents, recursively\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fscorta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Fscorta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fscorta/lists"}