![]() |
VOOZH | about |
dotnet add package Black.Beard.Helpers.ContentLoaders --version 2.0.59
NuGet\Install-Package Black.Beard.Helpers.ContentLoaders -Version 2.0.59
<PackageReference Include="Black.Beard.Helpers.ContentLoaders" Version="2.0.59" />
<PackageVersion Include="Black.Beard.Helpers.ContentLoaders" Version="2.0.59" />Directory.Packages.props
<PackageReference Include="Black.Beard.Helpers.ContentLoaders" />Project file
paket add Black.Beard.Helpers.ContentLoaders --version 2.0.59
#r "nuget: Black.Beard.Helpers.ContentLoaders, 2.0.59"
#:package Black.Beard.Helpers.ContentLoaders@2.0.59
#addin nuget:?package=Black.Beard.Helpers.ContentLoaders&version=2.0.59Install as a Cake Addin
#tool nuget:?package=Black.Beard.Helpers.ContentLoaders&version=2.0.59Install as a Cake Tool
Black.Beard.Helpers.ContentLoaders is a comprehensive utility library designed to simplify common file system operations, URI manipulations, and HTTP tasks in .NET applications. This package provides a collection of extension methods and helper classes that reduce boilerplate code, improve code readability, and handle platform-specific concerns when working with files, directories, and network resources.
Install-Package Black.Beard.Helpers
dotnet add package Black.Beard.Helpers
<PackageReference Include="Black.Beard.Helpers" Version="1.0.0" />
Simplify common file system operations with intuitive extension methods for FileInfo and DirectoryInfo.
using Bb;
// Create directory if it doesn't exist
DirectoryInfo dir = @"C:\temp\projects".CreateFolderIfNotExists();
// Clean up directories safely
DirectoryInfo cleaned = @"C:\temp\cache".DeleteFolderIfExists(recursive: true);
// Chain operations for concise code
DirectoryInfo workspace = new DirectoryInfo(@"C:\workspace")
.CreateFolderIfNotExists()
.WriteFile("readme.txt", "Project workspace initialized");
using Bb;
using System.Text;
// Write content to files with encoding options
FileInfo log = new FileInfo("application.log");
log.WriteFile("Application started", append: true);
log.WriteFile("Données spéciales", Encoding.UTF8, append: true);
// Easy file copying with overwrite control
FileInfo source = new FileInfo("template.docx");
bool success = source.CopyToDirectory(@"C:\backup", overwrite: false);
// Copy with directory objects
var sourceDir = new DirectoryInfo(@"C:\documents");
var backupDir = new DirectoryInfo(@"C:\backup");
sourceDir.Copy("important.xlsx", backupDir);
Path Operations
Handle file paths consistently across platforms with helper methods for common path manipulations.
using Bb;
// Convert between string paths and FileInfo/DirectoryInfo
FileInfo file = @"C:\config\settings.json".AsFile();
DirectoryInfo dir = @"C:\logs".AsDirectory();
// Check if paths are absolute
bool isAbsFile = @"C:\data\report.pdf".FilePathIsAbsolute(); // true
bool isAbsDir = "./temp".DirectoryPathIsAbsolute(); // false
// Format and normalize paths
string normalizedPath = "file:///C:/Users/name/My%20Documents/".FormatPath();
// On Windows: "C:\Users\name\My Documents\"
using Bb;
// Platform-aware path comparison
bool areEqual = @"C:\Program Files".IsPathEquals(@"c:\program files");
// true on Windows, false on Linux
// Safely combine path segments
string path = @"C:\projects".Combine("src", "main", "resources");
// "C:\projects\src\main\resources"
// Type-safe path combination
var baseDir = new DirectoryInfo(@"C:\workspace");
string fullPath = baseDir.Combine("configs", "settings.json");
URI and URL Manipulation Build, transform, and manipulate URIs with ease using extension methods and helpers.
using Bb;
// Create URIs with path segments
Uri api = "https://api.example.com".ToUri("v2", "users");
// https://api.example.com/v2/users
// Find available ports and create URIs
int port = 8000;
Uri serviceUri = "http".ToUri("localhost", ref port, "api");
// port will be updated to an available port number
// Combine URL parts safely
string url = UriExtensions.Combine(
"https://example.com",
"search",
"?q=dotnet",
"&page=1"
);
// https://example.com/search?q=dotnet&page=1
using Bb;
using System.Collections.Generic;
// Add multiple URIs with dynamic ports
var endpoints = new List<Uri>();
int startPort = 5000;
endpoints.AddLocalhostUrl("http", ref startPort, 3);
// Adds 3 URIs with available ports starting from 5000
// Concatenate URIs with separators
var services = new List<Uri> {
new Uri("http://auth.local:9000"),
new Uri("http://api.local:9001")
};
string serviceList = services.ConcatUrl().ToString();
// "http://auth.local:9000;http://api.local:9001"
HTTP and Network Helpers Simplify HTTP operations and network resource handling with specialized helpers.
using Bb;
using System.IO;
// Download content from a URL to a file
Uri source = new Uri("https://example.com/files/document.pdf");
FileInfo target = new FileInfo("downloaded-document.pdf");
source.Download(target);
// With custom HTTP client configuration
source.Download(target, client => {
client.DefaultRequestHeaders.Add("Authorization", "Bearer token123");
client.Timeout = TimeSpan.FromMinutes(5);
});
using Bb;
// Find available network ports
int port = HttpHelper.GetAvailablePort(8080);
Console.WriteLine($"Port {port} is available for use");
// Create URIs for local or remote hosts
Uri localHttp = HttpHelper.GetLocalUri(false); // http://localhost/
Uri localHttps = HttpHelper.GetLocalUri(true, 8443); // https://localhost:8443/
Uri remoteApi = HttpHelper.GetUri(false, "api.example.com", 80);
Content and Encoding Management Work with content in various formats and encodings with smart detection and conversion utilities.
using Bb;
// Register support for additional encodings
ContentHelper.RegisterEncoding();
// Auto-detect encoding from content
byte[] fileBytes = File.ReadAllBytes("document.txt");
string content = fileBytes.LoadContentFromText();
// Convert between streams and strings
using (var memStream = new MemoryStream(fileBytes))
{
string text = memStream.ConvertToString();
Console.WriteLine($"Detected content: {text}");
}
using Bb;
using System.Text.Json;
// Base64 encoding and decoding
string original = "Sensitive data: password123";
string encoded = original.ConvertToBase64();
string decoded = encoded.ConvertFromBase64();
// Simplified JSON serialization
var person = new { Name = "John", Age = 30 };
string json = person.Serialize(indented: true);
// Deserialize JSON to strongly-typed objects
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
var deserializedPerson = json.Deserialize<Person>(options);
Black.Beard.Helpers.ContentLoaders is designed to work across Windows, macOS, and Linux platforms. It includes special handling for platform-specific behaviors:
Path comparisons: Case-insensitive on Windows, case-sensitive on Unix-based systems
Path separators: Handles both forward and backward slashes regardless of platform
Path normalization: Consistently formats paths according to platform conventions
URI handling: Platform-agnostic implementation for URI manipulations
Windows, macOS, and Linux compatibility with platform-specific behavior handling
Path format normalization that handles both forward and backward slashes
Case sensitivity awareness (case-insensitive on Windows, case-sensitive on Unix systems)
Encoding detection and conversion that works across different platforms
The library automatically adapts to the underlying operating system, ensuring consistent behavior regardless of where your application runs.
This library is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on Black.Beard.Helpers.ContentLoaders:
| Package | Downloads |
|---|---|
|
Black.Beard.Roslyn
Helper for compile Csharp at runtime |
|
|
Black.Beard.Build
Helper for compile Csharp at runtime |
|
|
Black.Beard.Projects.Models
Helper for compile Csharp at runtime |
|
|
Black.Beard.Web.Server
Provide a service base for just concentrate your services |
|
|
Black.Beard.Configurations
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.59 | 494 | 4/4/2025 |
| 2.0.58 | 332 | 4/3/2025 |
| 2.0.57 | 317 | 4/3/2025 |
| 2.0.56 | 316 | 4/2/2025 |
| 2.0.55 | 320 | 4/2/2025 |
| 2.0.54 | 575 | 3/31/2025 |
| 2.0.53 | 275 | 3/27/2025 |
| 2.0.51 | 292 | 3/17/2025 |
| 2.0.50 | 323 | 3/13/2025 |
| 2.0.49 | 536 | 1/12/2025 |
| 2.0.47 | 521 | 12/7/2024 |
| 2.0.46 | 273 | 11/29/2024 |
| 2.0.45 | 258 | 11/27/2024 |
| 2.0.44 | 357 | 11/27/2024 |
| 2.0.43 | 275 | 11/24/2024 |
| 2.0.42 | 336 | 11/24/2024 |
| 2.0.41 | 394 | 11/19/2024 |
| 2.0.40 | 826 | 10/28/2024 |
| 2.0.39 | 831 | 9/23/2024 |
| 2.0.38 | 297 | 5/18/2024 |