ByteDev.Io
7.1.0
See the version list below for details.
dotnet add package ByteDev.Io --version 7.1.0
NuGet\Install-Package ByteDev.Io -Version 7.1.0
<PackageReference Include="ByteDev.Io" Version="7.1.0" />
paket add ByteDev.Io --version 7.1.0
#r "nuget: ByteDev.Io, 7.1.0"
// Install ByteDev.Io as a Cake Addin #addin nuget:?package=ByteDev.Io&version=7.1.0 // Install ByteDev.Io as a Cake Tool #tool nuget:?package=ByteDev.Io&version=7.1.0
ByteDev.Io
Set of IO related .NET utility classes.
Installation
ByteDev.Io has been written as a .NET Standard 2.0 library, so you can consume it from a .NET Core or .NET Framework 4.6.1 (or greater) application.
ByteDev.Io is hosted as a package on nuget.org. To install from the Package Manager Console in Visual Studio run:
Install-Package ByteDev.Io
Further details can be found on the nuget page.
Release Notes
Releases follow semantic versioning.
Full details of the release notes can be viewed on GitHub.
Usage
To use these main public classes simply reference ByteDev.Io
.
FileSytem
Provides a small set of methods for working with files and directories.
Methods:
- IsFile
- IsDirectory
- FirstExists
- MoveFile
- CopyFile
- SwapFileNames
// Initialize object
IFileSystem fs = new FileSystem();
// Is it a file? Is it a directory?
bool isFile = fs.IsFile(@"C:\Temp\Something");
bool isDir = fs.IsDirectory(@"C:\Temp\Something");
// Return first thing that exists
string[] paths =
{
@"C:\Temp\Test1.txt",
@"C:\Temp\Test2.txt",
@"C:\Temp\TestDirectory",
};
var path = fs.FirstExists(paths);
// Move a file
string sourceFile = @"C:\Temp\TestFile1.txt";
string destinationFile = @"C:\Windows\TestFile1.txt";
FileInfo info = fs.MoveFile(sourceFile, destinationFile,
FileOperationBehaviourType.DestExistsOverwrite);
// info.FullName = @"C:\Windows\TestFile1.txt" if successful
// Copy a file
string sourceFile = @"C:\Temp\TestFile1.txt";
string destinationFile = @"C:\Windows\TestFile1.txt";
FileInfo info = fs.CopyFile(sourceFile, destinationFile,
FileOperationBehaviourType.DestExistsOverwrite);
// info.FullName = @"C:\Windows\TestFile1.txt" if successful
// Swap two existing file's names
string file1 = @"C:\Temp\archive1.png";
string file2 = @"C:\Temp\cover.png";
fs.SwapFileNames(file1, file2);
FileSize
Represents file size.
long numberOfBytes = 1048576;
FileSize fileSize = new FileSize(numberOfBytes, FileSize.MultiplierType.DecimalMultiplier);
Console.Write(fileSize.ReadableSize); // "1 MB"
Console.Write(fileSize.TotalBytes); // 1048576
Console.Write(fileSize.TotalKiloBytes); // 1048
Console.Write(fileSize.TotalMegaBytes); // 1
FileComparer
Provides functionality to compare two files.
Methods:
- IsSourceBigger
- IsSourceBiggerOrEqual
- IsSourceModifiedMoreRecently
IsolatedStorageIo
Provides functionality for isolated storage operations. To use reference namespace: ByteDev.Io.IsolatedStorage
.
Methods:
- Exists
- Delete
- Write
- Read
- ReadAsXmlDoc
- ReadAsXDoc
var io = new IsolatedStorageIo(IsolatedStorageFileType.UserStoreForApplication);
var fileName = new IsolatedStorageFileName("MyIsolatedFile", new Version(1, 0), ".txt");
io.Write(fileName, "Some data");
bool exists = io.Exists(fileName);
string data = io.Read(fileName);
io.Delete(fileName);
StreamFactory
Provides simple functionality to create memory streams.
MemoryStream stream = StreamFactory.Create("some text");
DirectoryInfoExtensions
- CreateDirectory
- DeleteIfExists
- DeleteIfEmpty
- DeleteDirectories
- DeleteDirectoriesWithName
- DeleteEmptyDirectories
- DeleteFiles
- DeleteFilesExcept
- Empty
- EmptyIfExists
- GetFilesByExtensions
- GetAudioFiles
- GetImageFiles
- GetVideoFiles
- GetSize
- IsEmpty
FileInfoExtensions
- AddExtension
- DeleteIfExists
- DeleteLine
- DeleteLines
- GetExtension
- GetNextAvailableFileName
- HasExtension
- IsBinary
- RenameExtension
- RemoveExtension
- ReplaceLine
- ReplaceLines
StreamExtensions
- IsEmpty
- ReadAsBase64
- ReadAsBytes
- ReadAsMemoryStream
- ReadAsString
- WriteToFile
- WriteToFileAsync
StreamReaderExtensions
- ReadLineKeepNewLineChars
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- ByteDev.Strings (>= 8.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ByteDev.Io:
Package | Downloads |
---|---|
ByteDev.Testing
.NET Standard library that provides some testing related functionality. |
|
ByteDev.DotNet.Cleaner
Provides functionality to quickly clean .NET solutions, git repositories, user info, etc. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
7.4.1 | 257 | 9/8/2023 |
7.4.0 | 1,468 | 1/5/2022 |
7.3.0 | 437 | 10/11/2021 |
7.2.1 | 1,135 | 5/24/2021 |
7.2.0 | 390 | 3/16/2021 |
7.1.0 | 469 | 11/19/2020 |
7.0.0 | 456 | 9/30/2020 |
6.0.0 | 900 | 9/24/2020 |
5.0.0 | 616 | 4/12/2020 |
4.0.0 | 612 | 11/29/2019 |
3.2.1 | 793 | 1/19/2019 |
3.2.0 | 781 | 1/19/2019 |
3.1.0 | 871 | 10/1/2018 |
3.0.0 | 805 | 9/19/2018 |
2.0.0 | 1,015 | 5/22/2018 |