{"id":21059088,"url":"https://github.com/ganeshrvel/npm-electron-root-path","last_synced_at":"2025-10-08T18:17:17.126Z","repository":{"id":57221886,"uuid":"166629750","full_name":"ganeshrvel/npm-electron-root-path","owner":"ganeshrvel","description":"Utility to retrieve the root path of an Electron application.","archived":false,"fork":false,"pushed_at":"2023-09-06T22:38:25.000Z","size":12,"stargazers_count":24,"open_issues_count":3,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-27T17:49:07.218Z","etag":null,"topics":["electron","ganeshrvel","nodejs","npm","path","root","rootpath"],"latest_commit_sha":null,"homepage":"https://github.com/ganeshrvel/npm-electron-root-path","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/ganeshrvel.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-20T06:15:46.000Z","updated_at":"2024-09-09T12:00:54.000Z","dependencies_parsed_at":"2024-06-18T16:56:29.809Z","dependency_job_id":"23b5ba85-989e-48d6-bf3e-c9965703e885","html_url":"https://github.com/ganeshrvel/npm-electron-root-path","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fnpm-electron-root-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fnpm-electron-root-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fnpm-electron-root-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ganeshrvel%2Fnpm-electron-root-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ganeshrvel","download_url":"https://codeload.github.com/ganeshrvel/npm-electron-root-path/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254447820,"owners_count":22072754,"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":["electron","ganeshrvel","nodejs","npm","path","root","rootpath"],"created_at":"2024-11-19T17:09:53.905Z","updated_at":"2025-10-08T18:17:17.121Z","avatar_url":"https://github.com/ganeshrvel.png","language":"JavaScript","funding_links":["https://paypal.me/ganeshrvel"],"categories":[],"sub_categories":[],"readme":"# npm: electron-root-path\n\n- Author: [Ganesh Rathinavel](https://www.linkedin.com/in/ganeshrvel \"Ganesh Rathinavel\")\n- License: [MIT](https://github.com/ganeshrvel/openmtp/blob/master/LICENSE \"MIT\")\n- Website URL: [https://github.com/ganeshrvel/npm-electron-root-path](https://github.com/ganeshrvel/npm-electron-root-path/ \"https://github.com/ganeshrvel/npm-electron-root-path\")\n- Repo URL: [https://github.com/ganeshrvel/npm-electron-root-path](https://github.com/ganeshrvel/npm-electron-root-path/ \"https://github.com/ganeshrvel/npm-electron-root-path\")\n- Contacts: ganeshrvel@outlook.com\n\n\n### Introduction\n\n##### Get the root path of an Electron Application.\n\nFinding the root path of an electron app can be tricky, this npm package solves this issue. Follow further instructions to implement the same inside your app.\n\nInitially, I'd created **electron-root-path** package for [OpenMTP  - Advanced Android File Transfer Application for macOS](https://github.com/ganeshrvel/openmtp \"OpenMTP  - Advanced Android File Transfer Application for macOS\"). It works fine with [Electron React Redux Advanced Boilerplate](https://github.com/ganeshrvel/electron-react-redux-advanced-boilerplate \"Electron React Redux advanced boilerplate\") and [electron-react-boilerplate](https://github.com/electron-react-boilerplate/electron-react-boilerplate \"electron-react-boilerplate\")\n\n## Installation\n\n```shell\n$ npm install electron-root-path\n\nor \n\n$ yarn add electron-root-path\n```\n\n## Usage\n\n```javascript\n// Import ES6 way\nimport { rootPath } from 'electron-root-path';\n\n// Import ES5 way\nconst rootPath = require('electron-root-path').rootPath;\n\n// e.g:\n// read a file in the root\nconst location = path.join(rootPath, 'package.json');\nconst pkgInfo = fs.readFileSync(location, { encoding: 'utf8' });\n```\n\n- After packaging the app, the *rootPath* will point to the absolute directory path of \u003cAPP_PACKAGE_NAME\u003e.app\n\n```javascript\n// eg: /Applications/AppName.app\n```\n- Handle the packaged condition if required using:\n\n```javascript\nconst isProd = process.env.NODE_ENV === 'production';\n\n// or\n\n// npm install electron-is-packaged\n\nconst isPackaged = require('electron-is-packaged').isPackaged;\n```\n\n\n## Building from Source\n\nRequirements: [Node.js v6+](https://nodejs.org/en/download/ \"Install Node.js\"), [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git \"Install Git\") and [npm](https://www.npmjs.com/get-npm \"Install Node package manager\")\n\n\n### Clone\n```shell\n$ git clone --depth 1 --single-branch --branch master https://github.com/ganeshrvel/npm-electron-root-path.git\n\n$ cd npm-electron-root-path\n```\n\n### Contribute\n- Fork the repo and create your branch from master.\n- Ensure that the changes pass linting.\n- Update the documentation if needed.\n- Make sure your code lints.\n- Issue a pull request!\n\nWhen you submit code changes, your submissions are understood to be under the same [MIT License](https://github.com/ganeshrvel/npm-electron-root-path/blob/master/LICENSE \"MIT License\") that covers the project. Feel free to contact the maintainers if that's a concern.\n\n\n### Buy me a coffee\nHelp me keep the app FREE and open for all.\nPaypal me: [paypal.me/ganeshrvel](https://paypal.me/ganeshrvel \"paypal.me/ganeshrvel\")\n\n### Contacts\nPlease feel free to contact me at ganeshrvel@outlook.com\n\n### More repos\n- [Electron React Redux Advanced Boilerplate](https://github.com/ganeshrvel/electron-react-redux-advanced-boilerplate \"Electron React Redux Advanced Boilerplate\")\n- [OpenMTP  - Advanced Android File Transfer Application for macOS](https://github.com/ganeshrvel/openmtp \"OpenMTP  - Advanced Android File Transfer Application for macOS\")\n- [Tutorial Series by Ganesh Rathinavel](https://github.com/ganeshrvel/tutorial-series-ganesh-rathinavel \"Tutorial Series by Ganesh Rathinavel\")\n\n### License\nelectron-root-path | Get the root path of an Electron Application is released under [MIT License](https://github.com/ganeshrvel/npm-electron-root-path/blob/master/LICENSE \"MIT License\").\n\nCopyright © 2018-Present Ganesh Rathinavel\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganeshrvel%2Fnpm-electron-root-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fganeshrvel%2Fnpm-electron-root-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fganeshrvel%2Fnpm-electron-root-path/lists"}