{"id":20982999,"url":"https://github.com/disqada/pathfinder","last_synced_at":"2026-02-04T08:01:51.812Z","repository":{"id":154089533,"uuid":"626039129","full_name":"DisQada/PathFinder","owner":"DisQada","description":"Easily find files in your project","archived":false,"fork":false,"pushed_at":"2024-09-14T06:21:49.000Z","size":545,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-18T05:41:35.115Z","etag":null,"topics":["directory","file","filesystem","nodejs","npm","npm-package","path","pathfinding","tool"],"latest_commit_sha":null,"homepage":"http://docs.disqada.org/PathFinder/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DisQada.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"github":"nabil-alsaiad","ko_fi":"nabil_alsaiad","custom":["https://wise.com/share/nabila567"]}},"created_at":"2023-04-10T17:05:43.000Z","updated_at":"2024-10-08T09:54:37.000Z","dependencies_parsed_at":"2024-02-17T08:29:10.353Z","dependency_job_id":"72d6f717-6ccd-45fe-8274-92f11c1e85c6","html_url":"https://github.com/DisQada/PathFinder","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/DisQada/PathFinder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DisQada%2FPathFinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DisQada%2FPathFinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DisQada%2FPathFinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DisQada%2FPathFinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DisQada","download_url":"https://codeload.github.com/DisQada/PathFinder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DisQada%2FPathFinder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261126148,"owners_count":23113284,"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":["directory","file","filesystem","nodejs","npm","npm-package","path","pathfinding","tool"],"created_at":"2024-11-19T05:47:24.268Z","updated_at":"2026-02-04T08:01:46.736Z","avatar_url":"https://github.com/DisQada.png","language":"JavaScript","funding_links":["https://github.com/sponsors/nabil-alsaiad","https://ko-fi.com/nabil_alsaiad","https://wise.com/share/nabila567"],"categories":[],"sub_categories":[],"readme":"# PathFinder\n\n## Badges\n\n[![github](https://img.shields.io/badge/DisQada/PathFinder-000000?logo=github\u0026logoColor=white)](https://www.github.com/DisQada/PathFinder)\n[![npm](https://img.shields.io/badge/@disqada/pathfinder-CB3837?logo=npm\u0026logoColor=white)](https://www.npmjs.com/package/@disqada/pathfinder)\n\n![version](https://img.shields.io/npm/v/@disqada/pathfinder.svg?label=latest\u0026logo=npm)\n![monthly downloads](https://img.shields.io/npm/dm/@disqada/pathfinder.svg?logo=npm)\n\n![test](https://github.com/DisQada/PathFinder/actions/workflows/test.yml/badge.svg)\n[![Generate and Deploy documentation](https://github.com/DisQada/PathFinder/actions/workflows/docs.yml/badge.svg)](https://github.com/DisQada/PathFinder/actions/workflows/docs.yml)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?logo=semantic-release)](https://github.com/semantic-release/semantic-release)\n\n## Table of Contents\n\n- [PathFinder](#pathfinder)\n  - [Badges](#badges)\n  - [Table of Contents](#table-of-contents)\n  - [About](#about)\n  - [Learn](#learn)\n  - [License](#license)\n- [Getting started](#getting-started)\n  - [Store paths](#store-paths)\n  - [Find paths](#find-paths)\n- [Same file names](#same-file-names)\n  - [Renaming files](#renaming-files)\n  - [Receiving all matches](#receiving-all-matches)\n  - [Filtering by different properties](#filtering-by-different-properties)\n    - [Extension difference](#extension-difference)\n    - [Folder difference](#folder-difference)\n\n## About\n\nThis tool was made to be able to find file paths using only their names, or getting all the paths of files with \"hello\" word in their names.\nThe file paths you want to get later must be stored first, this will usually be done at the beginning of the program.\n\n## Learn\n\nCheck the [Getting started](#getting-started) guide for first time usage.\n\n## License\n\nCopyright \u0026copy; 2023 [DisQada](https://github.com/DisQada)\n\nThis tool is licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).  \nSee the [LICENSE](LICENSE) file for more information.\n\n# Getting started\n\n## Store paths\n\nThe first thing to do when using this tool is to store all the paths that will be required later on in some other file\n\nTo store the wanted file paths, use the function `storeFolderPaths()` and specify the array of directories to store their file paths.\n\n\u003e Store all the paths (once) at the beginning of the discord bot (or application)\n\nLet's say that this is out workspace\n\n```bash\n\u003croot\u003e\n  ├── package.json\n  ├── src\n  │     ├── a.js\n  │     └── b.js\n  └── data\n        └── a.json\n```\n\nWe use this code to store the paths of all files in the `src` and `data` folder\n\n```js\nimport { storeFolderPaths } from '@disqada/pathfinder'\nstoreFolderPaths(['src', 'data'])\n```\n\nNow we'll have the following paths stored successfully\n\n\u003e The file paths are stored in order\n\n```bash\n.../src/a.js\n.../src/b.js\n.../data/a.json\n```\n\n## Find paths\n\nIn another file in the middle of some function, you want to require a module of one of the files stored earlier, you remember it's name but you don't remember it's location and you don't want to modify the path in the require function every time you move one of the files\n\nHere is where this tools comes to help, if you only know the name of the file then you can easily fetch it's full path using the function `findPath()` or `findPaths()`\n\n\u003e Both functions work the same, it's just that `filePath()` returns the first match while `filePaths()` returns them all in an array\n\nLet's say that we want to require the file `src/b.js`, we use the following code for that\n\n```js\nimport { findPath } from '@disqada/pathfinder'\n\nconst filePath = findPath({ name: 'b' })\nconst { ... } = (await import(filePath.fullPath)).default\n```\n\nWith that we successfully required the module and used it just like normal but without the need to know it's full path\n\nIf you have multiple files with the same name, then check [Same file names](#same-file-names) guide\n\n# Same file names\n\nLet's say that this is out workspace\n\n```bash\n\u003croot\u003e\n  ├── package.json\n  └── src\n        ├── a.js\n        └── a.json\n```\n\nNow let's say we've written some code and we want to require the file `src/a.json`, we can use the same code, but there is a problem, the function is returning the path of `src/a.js` instead of `src/a.json` because it was stored before and the function will return the first match\n\nTo work around this, we have couple of choices\n\n## Renaming files\n\nRenaming one of the files to another name will solve this problem, but it's not always something we can do\n\n## Receiving all matches\n\nInstead of getting one file path, we can get an array of all the file paths of that name by changing the function from `findPath()` to `findPaths()`\n\n```js\nimport { findPaths } from '@disqada/pathfinder'\n\nconst filePaths = findPaths({ name: 'a' })\nconst { ... } = (await import(filePaths[1].fullPath)).default\n```\n\nThis will solve the problem, for now, what if we then added another file named `a.js` somewhere in our project or the order of the files changed (files order in the workspace or the order of storing)?\n\n## Filtering by different properties\n\n\u003e More than filtering property can be used at the same time\n\n### Extension difference\n\nThe best way to work around the problem of file name conflict is by adding more details to the `FilterOptions` object parameter\n\nBoth files have the same file name and path except for only the extension, so we can specify the `extension` property in the `FilterOptions` parameter to get our desired file\n\n```js\nimport { findPath } from '@disqada/pathfinder'\n\nconst filePath = findPath({ extension: 'json' })\nconst { ... } = (await import(filePath.fullPath)).default\n```\n\n### Folder difference\n\nIf our workspace was instead like this, where both the files' name and extension are identical, but they're in different folder\n\n```bash\n\u003croot\u003e\n  ├── package.json\n  ├── src\n  │     └── a.js\n  └── data\n        └── a.js\n```\n\nThen the way we'll get the correct path is as follows\n\n```js\nimport { findPath } from '@disqada/pathfinder'\n\nconst filePath = findPath({ folder: 'data' })\nconst { ... } = (await import(filePath.fullPath)).default\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisqada%2Fpathfinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdisqada%2Fpathfinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisqada%2Fpathfinder/lists"}