{"id":15703826,"url":"https://github.com/ievangelist/pathological.globbing","last_synced_at":"2025-05-12T14:19:45.948Z","repository":{"id":198279190,"uuid":"696042173","full_name":"IEvangelist/pathological.globbing","owner":"IEvangelist","description":".NET globbing library—built atop Microsoft.Extensions.FileSystemGlobbing.","archived":false,"fork":false,"pushed_at":"2025-04-03T19:51:06.000Z","size":996,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-08T19:56:10.621Z","etag":null,"topics":["csharp","dotnet","file-system-globbing","glob","globber","globbing","globbing-library"],"latest_commit_sha":null,"homepage":"","language":"C#","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/IEvangelist.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":"2023-09-25T00:37:32.000Z","updated_at":"2025-04-03T19:50:39.000Z","dependencies_parsed_at":"2024-07-11T21:19:12.069Z","dependency_job_id":"971881ca-35fe-4c86-b4f2-9082df84c41a","html_url":"https://github.com/IEvangelist/pathological.globbing","commit_stats":{"total_commits":68,"total_committers":2,"mean_commits":34.0,"dds":0.3529411764705882,"last_synced_commit":"36fef6e9b83c69b4da3d142bb9f01611976c4961"},"previous_names":["ievangelist/pathological.globbing"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IEvangelist%2Fpathological.globbing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IEvangelist%2Fpathological.globbing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IEvangelist%2Fpathological.globbing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IEvangelist%2Fpathological.globbing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IEvangelist","download_url":"https://codeload.github.com/IEvangelist/pathological.globbing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249902358,"owners_count":21342824,"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":["csharp","dotnet","file-system-globbing","glob","globber","globbing","globbing-library"],"created_at":"2024-10-03T20:06:46.814Z","updated_at":"2025-04-20T13:30:59.938Z","avatar_url":"https://github.com/IEvangelist.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Pathological: Globbing\n\n![.NET: Build \u0026 Test](https://img.shields.io/github/actions/workflow/status/IEvangelist/pathological.globbing/dotnet.yml?logo=github\u0026label=build%20%26%20test\u0026link=https%3A%2F%2Fgithub.com%2FIEvangelist%2Fpathological.globbing%2Factions%2Fworkflows%2Fdotnet.yml)\n![Nuget: Pathological.Globbing](https://img.shields.io/nuget/vpre/Pathological.Globbing?logo=nuget\u0026label=nuget%20package\u0026link=https%3A%2F%2Fwww.nuget.org%2Fpackages%2FPathological.Globbing)\n![License](https://img.shields.io/github/license/IEvangelist/pathological.globbing?logo=license\u0026link=https%3A%2F%2Fgithub.com%2FIEvangelist%2Fblazorators%2Fblob%2Fmain%2FLICENSE)\n![C#](https://img.shields.io/github/languages/top/IEvangelist/pathological.globbing?label=C%23\u0026labelColor=fff\u0026color=%23512BD4)\n![IEvangelist followers](https://img.shields.io/github/followers/IEvangelist?label=IEvangelist\u0026style=social\u0026logo=github\u0026labelColor=000\u0026color=fff\u0026link=https%3A%2F%2Fgithub.com%2FIEvangelist%3Ftab%3Dfollowers)\n![GitHub Sponsors](https://img.shields.io/github/sponsors/IEvangelist?style=social\u0026logo=githubsponsors\u0026labelColor=eee\u0026color=%23EA4AAA\u0026link=https%3A%2F%2Fgithub.com%2Fsponsors%2FIEvangelist)\n\nWelcome to the Pathological Globbing library. This library is a wrapper around the `Microsoft.Extensions.FileSystemGlobbing` NuGet package, which provides a fast, efficient, and cross-platform globbing functionality for .NET.\n\nThis library strives to simplify globbing by exposing a `Glob` type, which provides an approachable API for matching file paths against globbing patterns.\n\n## 📦 Install\n\nTo install the `Pathological.Globbing` NuGet package, run the following command:\n\n```\ndotnet add package Pathological.Globbing\n```\n\nAlternatively, you can install the `Pathological.Globbing` NuGet package from the package manager in Visual Studio.\n\n## *️⃣ Usage\n\nTo use the `Pathological.Globbing` library, you must first create a `Glob` instance. The `Glob` instance is the entry point to the library, and provides a number of methods for matching file paths against globbing patterns.\n\n```csharp\nusing Pathological.Globbing;\n\nvar glob = new Glob();\n\n// All js files, but don't look in node_modules\nvar files = glob.GetMatches(\"**/*.js\", \"node_modules/**\");\n\nforeach (var filePath in files)\n{\n    // Use file...\n}\n```\n\n\u003e [!NOTE]\n\u003e There are various extensions methods that expose, in addition to a `string` representing the fully qualified file path of the matched file, a `GlobMatch` instance. The `GlobMatch` instance provides additional information about the matched file, it can also be used to easily convert to a `FileInfo` type as well.\n\n### 📂 Streaming API\n\nTo use the streaming API, call any of the available `IAsyncEnumerable\u003cT\u003e` returning extension methods.\n\n```csharp\nusing Pathological.Globbing;\n\nvar glob = new Glob(basePath: \"../\");\n\n// All js files, but don't look in node_modules\nvar files = glob.GetMatchesAsync(\"**/*.js\", \"node_modules/**\");\n\nawait foreach (var file in files)\n{\n    // Use file...\n}\n```\n\n\u003e [!IMPORTANT]\n\u003e All streaming APIs support `CancellationToken` for signaling a manual cancellation, or `TimeSpan` for signaling cancellation after a certain amount of time.\n\n### ☑️ Builder-pattern fluent API\n\nTo use the builder-pattern fluent API, create a new `GlobOptionsBuilder` instance, and chain any available `With*` method. When you're done, call `Build` which validates the options, and returns a `GlobOptions` instance. The `GlobOptions` instance can be used to execute the globbing operation.\n\n```csharp\nusing Pathological.Globbing;\nusing Pathological.Globbing.Options;\n\n// Build glob options.\nvar builder = new GlobOptionsBuilder()\n    .WithBasePath(\"../../\")\n    .WithCaseInsensitive(isCaseInsensitive: true)\n    .WithPattern(\"**/*.cs\")\n    .WithIgnorePatterns([\"**/bin/**\", \"**/obj/**\"]);\n\n// Build the globbing options.\nvar options = builder.Build();\n\n// Get matching file infos.\nvar files = glob.GetMatchingFileInfos();\n\nforeach (var fileInfo in files)\n{\n    // Use fileInfo...\n}\n\n// Alternatively, execute the globbing operation, evaluating results.\nvar result = options.ExecuteEvaluation();\n\n_ = result.HasMatches;  // true\n_ = result.Matches;     // IEnumerable\u003cGlobMatch\u003e\n```\n\n## 🔥 File-system globbing\n\nThis library relies on the `Microsoft.Extensions.FileSystemGlobbing` NuGet package for file-system globbing.\n\nAll of the following patterns are supported:\n\n- Exact directory or file name\n  \n  - `some-file.txt`\n  - `path/to/file.txt`\n\n- Wildcards `*` in file and directory names that represent zero to many characters not including separator characters.\n\n    | Value          | Description                                                            |\n    |----------------|------------------------------------------------------------------------|\n    | `*.txt`        | All files with *.txt* file extension.                                  |\n    | `*.*`          | All files with an extension.                                           |\n    | `*`            | All files in top-level directory.                                      |\n    | `.*`           | File names beginning with '.'.                                         |\n    | `*word*`       | All files with 'word' in the filename.                                 |\n    | `readme.*`     | All files named 'readme' with any file extension.                      |\n    | `styles/*.css` | All files with extension '.css' in the directory 'styles/'.            |\n    | `scripts/*/*`  | All files in 'scripts/' or one level of subdirectory under 'scripts/'. |\n    | `images*/*`    | All files in a folder with name that is or begins with 'images'.       |\n\n- Arbitrary directory depth (`/**/`).\n\n    | Value | Description |\n    | --- | --- |\n    | `**/*` | All files in any subdirectory. |\n    | `dir/` | All files in any subdirectory under 'dir/'. |\n    | `dir/**/*` | All files in any subdirectory under 'dir/'. |\n\nFor more information, see [File globbing in .NET: Pattern formats](https://learn.microsoft.com/dotnet/core/extensions/file-globbing#pattern-formats).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fievangelist%2Fpathological.globbing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fievangelist%2Fpathological.globbing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fievangelist%2Fpathological.globbing/lists"}