{"id":17169018,"url":"https://github.com/sant123/cjs","last_synced_at":"2025-06-18T11:40:07.371Z","repository":{"id":37939591,"uuid":"323755454","full_name":"sant123/cjs","owner":"sant123","description":"A Deno implementation to create variables like __dirname and __filename of Node.js","archived":false,"fork":false,"pushed_at":"2022-07-21T06:57:58.000Z","size":222,"stargazers_count":13,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T14:45:33.321Z","etag":null,"topics":["commonjs","commonjs-deno","deno","dirname","filename"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/sant123.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":"2020-12-22T23:30:30.000Z","updated_at":"2024-06-21T17:05:39.000Z","dependencies_parsed_at":"2022-08-08T22:30:44.890Z","dependency_job_id":null,"html_url":"https://github.com/sant123/cjs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sant123/cjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sant123%2Fcjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sant123%2Fcjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sant123%2Fcjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sant123%2Fcjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sant123","download_url":"https://codeload.github.com/sant123/cjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sant123%2Fcjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260272425,"owners_count":22984308,"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":["commonjs","commonjs-deno","deno","dirname","filename"],"created_at":"2024-10-14T23:24:41.294Z","updated_at":"2025-06-18T11:40:02.359Z","avatar_url":"https://github.com/sant123.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cjs [![Deno](https://github.com/sant123/cjs/actions/workflows/deno.yml/badge.svg)](https://github.com/sant123/cjs/actions/workflows/deno.yml)\n\nCreate variables like `__dirname` and `__filename` in Deno. Their behavior is\nthe same as Node.js variables.\n\n## Usage\n\n```ts\n// example.ts\nimport { getDirname, getFilename } from \"https://deno.land/x/cjs/mod.ts\";\n\nconst __dirname = getDirname(import.meta.url);\nconst __filename = getFilename(import.meta.url);\n\n// Your code here...\n```\n\n## API\n\n### getDirname(importMetaUrl: string): string\n\nReturns the directory of the current module.\n\n### getFilename(importMetaUrl: string): string\n\nReturns the filename of the current module.\n\n## Node.js support\n\nThis should work with the\n[stable](https://nodejs.org/dist/latest-v15.x/docs/api/esm.html#esm_modules_ecmascript_modules)\nEcmascript modules implementation of Node.js. See this\n[link](https://nodejs.org/dist/latest-v15.x/docs/api/esm.html#esm_no_filename_or_dirname)\nfor more information.\n\n## Testing\n\nThis library is highly tested to provide the same variables behavior of Node.js.\nIf you see something is missing or ¿did you find a bug? pull requests are really\nwelcome.\n\n## Benchmark\n\nTested with Deno v1.24.0:\n\n![](benchmark/get_dirname.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsant123%2Fcjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsant123%2Fcjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsant123%2Fcjs/lists"}