{"id":21522186,"url":"https://github.com/hugoalh-studio/underscore-path-js","last_synced_at":"2025-07-16T07:31:04.791Z","repository":{"id":174914301,"uuid":"652973804","full_name":"hugoalh-studio/underscore-path-js","owner":"hugoalh-studio","description":"A JavaScript module to bring back `__dirname` and `__filename` within 2 lines of code.","archived":false,"fork":false,"pushed_at":"2024-03-29T07:35:13.000Z","size":376,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-29T08:36:45.179Z","etag":null,"topics":["dirname","filename","javascript","js"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hugoalh-studio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-06-13T06:57:49.000Z","updated_at":"2024-03-11T04:26:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"b66b7cd3-c77c-4baa-b7be-b47e3fb4be66","html_url":"https://github.com/hugoalh-studio/underscore-path-js","commit_stats":null,"previous_names":["hugoalh-studio/underscore-path-nodejs","hugoalh-studio/underscore-path-js"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugoalh-studio%2Funderscore-path-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugoalh-studio%2Funderscore-path-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugoalh-studio%2Funderscore-path-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugoalh-studio%2Funderscore-path-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugoalh-studio","download_url":"https://codeload.github.com/hugoalh-studio/underscore-path-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226112989,"owners_count":17575438,"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":["dirname","filename","javascript","js"],"created_at":"2024-11-24T01:09:32.882Z","updated_at":"2024-11-24T01:09:33.695Z","avatar_url":"https://github.com/hugoalh-studio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# __Path (JavaScript)\n\n[**⚖️** MIT](./LICENSE.md)\n\n**🗂️**\n[![GitHub: hugoalh-studio/underscore-path-js](https://img.shields.io/badge/hugoalh--studio/underscore--path--js-181717?logo=github\u0026logoColor=ffffff\u0026style=flat \"GitHub: hugoalh-studio/underscore-path-js\")](https://github.com/hugoalh-studio/underscore-path-js)\n[![NPM: @hugoalh/underscore-path](https://img.shields.io/badge/@hugoalh/underscore--path-CB3837?logo=npm\u0026logoColor=ffffff\u0026style=flat \"NPM: @hugoalh/underscore-path\")](https://www.npmjs.com/package/@hugoalh/underscore-path)\n\n**🆙** ![Latest Release Version](https://img.shields.io/github/release/hugoalh-studio/underscore-path-js?sort=semver\u0026color=2187C0\u0026label=\u0026style=flat \"Latest Release Version\") (![Latest Release Date](https://img.shields.io/github/release-date/hugoalh-studio/underscore-path-js?color=2187C0\u0026label=\u0026style=flat \"Latest Release Date\"))\n\nA JavaScript module to bring back `__dirname` and `__filename` within 2 lines of code.\n\n```js\n/* ☹️ */\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n```\n\n```js\n/* 🙂 */\nimport { underscorePath } from \"@hugoalh/underscore-path\";\nconst { __dirname, __filename } = underscorePath(import.meta.url);\n```\n\n## 🎯 Target\n\n- Bun ^ v1.0.0\n- Cloudflare Workers\n- Deno \u003e= v1.34.0\n  \u003e **🛡️ Require Permission**\n  \u003e\n  \u003e *N/A*\n- NodeJS \u003e= v16.13.0\n\n## 🔰 Usage\n\n### Via Installation\n\n\u003e **🎯 Supported Target**\n\u003e\n\u003e - Cloudflare Workers\n\u003e - NodeJS\n\n1. Install via console/shell/terminal:\n    - Via NPM\n      ```sh\n      npm install @hugoalh/underscore-path[@\u003cTag\u003e]\n      ```\n    - Via PNPM\n      ```sh\n      pnpm add @hugoalh/underscore-path[@\u003cTag\u003e]\n      ```\n    - Via Yarn\n      ```sh\n      yarn add @hugoalh/underscore-path[@\u003cTag\u003e]\n      ```\n2. Import at the script (`\u003cScriptName\u003e.js`):\n    ```js\n    import ... from \"@hugoalh/underscore-path\";\n    ```\n    \u003e **ℹ️ Note**\n    \u003e\n    \u003e Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit [file `package.json`](./package.json) property `exports` for available sub paths.\n\n### Via NPM Specifier\n\n\u003e **🎯 Supported Target**\n\u003e\n\u003e - Bun\n\u003e - Deno\n\n1. Import at the script (`\u003cScriptName\u003e.js`):\n    ```js\n    import ... from \"npm:@hugoalh/underscore-path[@\u003cTag\u003e]\";\n    ```\n    \u003e **ℹ️ Note**\n    \u003e\n    \u003e Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit [file `package.json`](./package.json) property `exports` for available sub paths.\n\n## 🧩 API\n\n- ```ts\n  function underscorePath(importMetaURL: string): UnderscorePathOutput;\n  ```\n- ```ts\n  interface UnderscorePathOutput {\n    __dirname: string;\n    __filename: string;\n  }\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugoalh-studio%2Funderscore-path-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugoalh-studio%2Funderscore-path-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugoalh-studio%2Funderscore-path-js/lists"}