{"id":22785716,"url":"https://github.com/quorumdms/filepath","last_synced_at":"2025-09-06T22:36:41.755Z","repository":{"id":38427210,"uuid":"230992434","full_name":"QuorumDMS/filepath","owner":"QuorumDMS","description":"node.URL like utility for manipulating file paths, names, and extensions","archived":false,"fork":false,"pushed_at":"2023-03-04T05:33:31.000Z","size":1219,"stargazers_count":2,"open_issues_count":8,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-17T04:15:21.826Z","etag":null,"topics":["directory","extension","file","filepath","files","folders","node","path","url"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QuorumDMS.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2019-12-30T23:13:44.000Z","updated_at":"2023-11-17T20:37:28.000Z","dependencies_parsed_at":"2023-07-16T16:15:36.845Z","dependency_job_id":null,"html_url":"https://github.com/QuorumDMS/filepath","commit_stats":null,"previous_names":["autovance/filepath"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/QuorumDMS/filepath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuorumDMS%2Ffilepath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuorumDMS%2Ffilepath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuorumDMS%2Ffilepath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuorumDMS%2Ffilepath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuorumDMS","download_url":"https://codeload.github.com/QuorumDMS/filepath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuorumDMS%2Ffilepath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273973960,"owners_count":25200578,"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-09-06T02:00:13.247Z","response_time":2576,"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":["directory","extension","file","filepath","files","folders","node","path","url"],"created_at":"2024-12-11T23:07:25.809Z","updated_at":"2025-09-06T22:36:41.732Z","avatar_url":"https://github.com/QuorumDMS.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @autovance/filepath\n\n\u003e URL like utility for manipulating file paths, names and extensions\n\nUse this class to parse and manipulate file paths and names across platforms. Check out the tests for example use.\n\n**Dependencies: zero**  \n**Test Coverage: 100%**\n\n## API\n\n### constructor\n\nSetup a path\n\n```js\nconst path = new FilePath('this/is/a/file.jpeg');\n```\n\n### path\n\n**Set**: set up a path. Used in the constructor  \n**Get**: get the fully qualified path\n\n```js\nconst originalFile = new FilePath();\noriginalFile.path = '/this/is/a/file.jpeg';\nconsole.log(originalFile.path);\n\n\u003e '/this/is/a/file.jpeg'\n```\n\n### file\n\n**Set**: set a file and extension  \nIf the extension is missing, it will be undefined.  \n**Get**: get the file with the extension\n\n```js\nconst path = new FilePath('this/is/a/file.jpeg');\npath.file = 'other.pdf'\n\nconsole.log(path.file, path.filename, path.extension, path.path);\n\n\u003e 'other.pdf'\n\u003e 'other'\n\u003e 'pdf'\n\u003e 'this/is/a/other.pdf'\n\npath.file = 'new';\n\nconsole.log(path.file, path.filename, path.extension, path.path);\n\n\u003e 'new'\n\u003e 'new'\n\u003e undefined\n\u003e 'this/is/a/new'\n```\n\n### dir\n\n**Set**: change the directory (without the file)  \n**Get**: get the directory (without the file)\n\n```js\nconst path = new FilePath('this/is/a/file.jpeg');\npath.dir = '/this/is/the'\n\nconsole.log(path.dir, path.file, path.filename, path.extension, path.path);\n\n\u003e '/this/is/the'\n\u003e 'file.jpeg'\n\u003e 'file'\n\u003e 'jpeg'\n\u003e '/this/is/the/file.jpeg'\n\n```\n\n### filename\n\n**Set**: set the filename (without extension)  \n**Get**: get the filename (without extension)\n\n```js\nconst path = new FilePath('this/is/a/file.jpeg');\npath.filename = 'new'\n\nconsole.log(path.file, path.filename, path.extension, path.path);\n\n\u003e 'new.jpeg'\n\u003e 'new'\n\u003e 'jpeg'\n\u003e 'this/is/a/new.jpeg'\n```\n\n### extension\n\n**Set**: set the extension  \n**Get**: get the extension (does not include the `.` delimiter)\n\n```js\nconst path = new FilePath('this/is/a/file.jpeg');\npath.extension = 'png';\n\nconsole.log(path.extension, path.file, path.path);\n\n\u003e 'png'\n\u003e 'file.png'\n\u003e 'this/is/a/file.png'\n```\n\n### folders\n\nAn ordered array of folder names. folders[0] represents the root of the path. If absolute, it will be empty '' (required), if relative, it will be the first folder, or reference '.' or '..'.\n\nThe recommended use it to change a specific folder in the path, using the index.\n\n```js\nconst path = new FilePath('/this/is/a/file.jpeg');\nconsole.log(path.folders);\n\n\u003e ['', 'this', 'is', 'a']\n\npath.path = 'this/is/the/file.jpeg';\nconsole.log(path.folders);\n\n\u003e ['this', 'is', 'the']\n\npath.folders.unshift('..');\npath.folders[path.folders.length - 1] = 'relative';\nconsole.log(path.folders, path.path);\n\n\u003e ['..', 'this', 'is', 'relative']\n\u003e '../this/is/relative/file.jpeg'\n```\n\n### isAbsolute and isRelative\n\nBooleans indicating if the path is absolute or relative. Absolute paths start with '/',\nand `path.folders[0] === ''`;\n\n```js\n\nconst path = new FilePath('/this/is/a/file.jpeg');\nconsole.log(path.isAbsolute, path.isRelative)\n\n\u003e true\n\u003e false\n\npath.path = 'this/is/a/file.jpeg';\nconsole.log(path.isAbsolute, path.isRelative)\n\n\u003e false\n\u003e true\n\npath.path = './this/is/a/file.jpeg';\nconsole.log(path.isAbsolute, path.isRelative)\n\n\u003e false\n\u003e true\n\npath.path = '../this/is/a/file.jpeg';\nconsole.log(path.isAbsolute, path.isRelative)\n\n\u003e false\n\u003e true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquorumdms%2Ffilepath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquorumdms%2Ffilepath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquorumdms%2Ffilepath/lists"}